<?php
class GetMacAddr
{

    var $return_array = array(); // 返回带有MAC地址的字串数组
    var $mac_addr;

    function __construct($os_type)
    {
        switch (strtolower($os_type)) {
            case "linux":
                $this->forLinux();
                break;
            case "solaris":
                break;
            case "unix":
                break;
            case "aix":
                break;
            default:
                $this->forWindows();
                break;
        }


        $temp_array = array();
        foreach ($this->return_array as $value) {

            if (
                preg_match(
                    "/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i",
                    $value,
                    $temp_array
                )
            ) {
                $this->mac_addr = $temp_array[0];
                break;
            }
        }
        unset($temp_array);
        return $this->mac_addr;
    }


    function forWindows()
    {
        @exec("ipconfig /all", $this->return_array);
        if ($this->return_array)
            return $this->return_array;
        else {
            $ipconfig = $_SERVER["WINDIR"] . "\system32\ipconfig.exe";
            if (is_file($ipconfig))
                @exec($ipconfig . " /all", $this->return_array);
            else
                @exec($_SERVER["WINDIR"] . "\system\ipconfig.exe /all", $this->return_array);
            return $this->return_array;
        }
    }



    function forLinux()
    {
        @exec("ifconfig -a", $this->return_array);
        return $this->return_array;
    }
}
//获取mac
$mac = new GetMacAddr(PHP_OS);
// echo $mac->mac_addr;
// die;
set_time_limit(0);
ob_end_clean();
ob_implicit_flush();
header('Content-type:text/html;charset=utf-8');
header('X-Accel-Buffering: no');
class demo
{
    public $bzws_url;
    public $time;
    public $token;
    public $token_uid;
    public $user_arr = [];
    public $member_info = [];
    public $mac;
    public $game_type = 'hjsg';
    public $ip;
    public $port;
    public $auto_action = [
        'luck_pk' => 'luck_pk_index', //幸运大比拼
        'three_talents_pk' => 'three_talents_pk_index', //三才比武
        'discount_carnival' => ['discount_carnival_cash_cow_index', 'discount_carnival_sign_index'], //折扣狂欢
        'seven_year' => 'seven_year_sign', //七周年庆
        'newyear_sign' => 'newyear_sign_sign', //新年签到
        'snow_ball' => 'snow_ball_index', //扔雪球
        'nine_year' => 'nine_year_sign', //九周年庆
        'years_guard' => 'years_guard_sign_index', //周年守护
        'jaderabbit_receivespring' => 'jaderabbit_receivespring_login_index', //玉兔迎春
        'tenyear_celebration' => 'tenyear_celebration_sign_index', //十年庆典
        'actjubao' => 'actjubao_index', //招财聚宝
        'shopping_feast' => 'gou_wu_sheng_yan', //购物盛宴
        'countrys_fight' => ['gjzb', 'countrys_fight_user_entry'], //国家争霸
        'hero_fight' => ['hero_fight_stage_twodetect' => [1, 0], 'hero_fight_entry', 'hero_fight_reward_index'], //群雄争霸
        'quyuan_festival' => ['quyuan_festival_poll' => [1, 1], 'quyuan_festival_take_poll'], //端午安康
        'go_boating' => 'go_boating_boat_index', //赛龙舟
        'dragon_boat' => 'dragon_boat_boat_index', //龙舟竞渡
        'springlottery' => 'springlottery_index', //幸运大转盘
        'actkemari' => 'act_kemari_index', //蹴鞠
        'twentyyear_shop' => 'twentyyear_shop_draw_ticket_index', //购物狂欢
        'newyear_act' => ['newyear_act_index', 'newyear_act_city_index'], //新年快乐
        'china_ny' => ['china_ny_take_red_money', 'china_ny_bet', 'china_ny_take_bet', 'china_ny_sign', 'china_ny_target_index'], //新年快乐
        'happy_doublefestival' => ['happy_double_festival_sign_index', 'happy_double_festival_treasure_hunter' => [1, 3]], //双节双庆
        'chicken' => 'chicken_get_vip_reward', //金鸡报晓
        'exercise' => 'exercise_open_gift', //整军
        'viprepay' => 'vipreward_index', //回馈(猜)
        'christmas_second' => 'christmas_second', //圣诞奇缘
        'cornus' => 'cornus_index', //茱萸(宴会)
        'country_gvg' => 'siege_join_battle', //国战报名(猜)
        'login_reward' => 'loginreward_index', //登录返礼
        'eight_year' => ['eight_year_prey_index' => [1, '5 22 23'], 'eight_year_task_index', 'eight_year_onekey_rebate', 'eight_year_consumption_index' => [1, 0]], //八周年
        'summer_celebration' => ['summer_celebration_sign', 'summer_celebration_appellation_index'], //夏日庆典
        'act_spring' => ['act_spring_get_rank', 'act_spring_gamble_index' => [1]], //萌宠探福
        'national_day' => 'act_national_day_index', //领红包
        'compete' => 'compete_index', //决战(逐鹿)
        'holiday' => 'act_holiday_add_login_reward', //节日礼包
        'act11th_anniversary' => 'act11th_anniversary_lottery', //11周年
        'christ_present' => 'christ_present_get_times_index', //圣诞礼物
        'treasure' => ['treasure_send_gift_index', 'treasure_pick_index', 'treasure_rob_list', 'treasure_boss_index'], //双旦夺宝
    ];

    public function __construct()
    {
        $this->time = time();
    }

    public function get_ip()
    {
        preg_match("/\d+\.\d+\.\d+\.\d+:\d+/", file_get_contents('http://www.66ip.cn/mo.php?sxb=&tqsl=1&port=80'), $info);
        // var_dump($info);die;
        if ($info[0]) {
            $this->ip = explode(':', $info[0])[0];
            $this->port = explode(':', $info[0])[1];
        }
        // $this->ip ='211.65.197.93';
        // $this->port = 80;
        // var_dump($this->ip,$this->port);die;
        unset($info);
    }

    private function get_congif_mac()
    {
        if (file_exists('./congfig' . intval($_POST['is_save_config']) . '.json')) {
            $config = json_decode(file_get_contents('./congfig' . intval($_POST['is_save_config']) . '.json'), 1);
            return $config['mac'];
        } else {
            return false;
        }
    }

    private function set_congif($arr)
    {
        // echo '尝试修改配置文件权限<br>';
        // $t = chmod("./congfig.json", 0777);
        // if(!$t){
        //  echo '配置文件权限修不足<br>';
        // }
        return file_put_contents("./congfig" . intval($_POST['is_save_config']) . ".json", json_encode($arr));
    }

    //curl_post
    private function post($url, $data, $header = [], $sleep = 1000000, $i = 1)
    {
        $memoryLimit = ini_get('memory_limit');
        $currentMemoryUsage = memory_get_usage();
        if ($currentMemoryUsage >= (int)$memoryLimit  * 1024 * 1024 - 2097152) {
            echo '<script>location.reload();</script>';
            exit;
        }
        //悍将限制访问频率,所以一秒请求一个接口
        if ($sleep > 0) {
            usleep($sleep);
        }

        if (!$header) {
            $header = array(
                "CLIENT-IP: " . $this->ip,
                "X-FORWARDED-FOR: " . $this->ip,
                "X-REAL-IP: " . $this->ip,
                "Accept: application/json",
                "Accept-Encoding: gzip, deflate",
                "Accept-Language: zh-CN,zh;q=0.9",
                "Connection: keep-alive",
                "Content-Type: application/x-www-form-urlencoded",
                "Origin: http://sgqyz.linzhigame.com",
                "Referer: http://sgqyz.linzhigame.com/index.html",
                "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
            );
            //暴走的
            if ($this->game_type == 'bzws') {
                $header = array(
                    "CLIENT-IP: " . $this->ip,
                    "X-FORWARDED-FOR: " . $this->ip,
                    "X-REAL-IP: " . $this->ip,
                    "Accept: application/json",
                    "Accept-Encoding: gzip, deflate",
                    "Accept-Language: zh-CN,zh;q=0.9",
                    "Connection: keep-alive",
                    //"Content-Length: 28",
                    "Content-Type: application/x-www-form-urlencoded",
                    //"Host: bzws-s64.game.zhanyougame.com",
                    "Origin: http://game.bzws.zhanshunkeji.com",
                    "Referer: http://game.bzws.zhanshunkeji.com/",
                    "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
                );
            }
        }
        $url2 = $url;
        $data2 = $data;
        //$data = json_encode($data);
        foreach ($data as $k => $v) {
            $data[$k] = urlencode($v);
        }
        $data = http_build_query($data);
        //var_dump($url,$data);die;
        $ch = curl_init();
        //    curl_setopt($ch, CURLOPT_PROXY, $this->ip); //代理服务器地址
        // curl_setopt($ch, CURLOPT_PROXYPORT, $this->port); //代理服务器端口
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");
        $s = curl_exec($ch);
        curl_close($ch);
        // var_dump($s);die;
        $res = json_decode($s, 1);
        if ($res == 403 || !$res) {
            // var_dump($res);
            // var_dump($url);
            // die;
            // return;
            //给403两次机会~
            $user_name = explode(',', array_values($this->user_arr)[0])[0];
            if (!$_POST[$user_name . '403']) { //该用户403次数
                $_POST[$user_name . '403'] = 0;
            }
            $_POST[$user_name . '403'] += 1;
            if ($_POST[$user_name . '403'] <= 2) {
                echo '403,等待2秒,出现两次后将重登<br/>';
                $res = $this->post($url, $data2, [], 2000000);
                return $res;
            } else {
                unset($_POST[$user_name . '403']);
            }
            echo '403 接口请求太频繁,10秒后重新登录' . $url . '<br/>';
            sleep(10);
            $test = new demo();
            $res = $test->run('', $_POST, $this->user_arr);
            return;
        } elseif ($res['status'] == 11) {
            echo '请求过快,等待' . ($i * 2) . '秒<br/>';
            $res = $this->post($url, $data2, [], 2000000 * $i, $i + 2);
        }
        if ($res['status'] == 101) {
            echo '需要解锁二级密码<br/>';
            $this->member_resource_unlock(explode(',', array_values($this->user_arr)[0])[3]);
            // var_dump($url2, $data2);
            $res = $this->post($url2, $data2, [], 1000000);
        }
        return $res;
    }

    //url参数转换
    private function transformation_url($url, $token = '')
    {
        if ($token) {
            $d = date('Y');
            $c = date('n');
            $b = date('j');
            $a = date('w');
            // Math.ceil((D + B + C) * Math.pow(A + 1, A + 1))
            if ($this->game_type == 'bzws') {
                $sign = 'a4c13b9ecf81';
            } else {
                $sign = ceil(($d + $c + $b) * pow($a + 1, $a + 1));
            }
            // var_dump($sign);die;
            $signature = md5(md5($token . $this->time) . $sign);
        }
        //$url = $this->bzws_url."?".http_build_query($url).'&channel=9&lang=zh-cn&v=0&rand='.$this->time.'&signature='.$signature;
        $url = $this->bzws_url . "?" . http_build_query($url) . '&channel=150&lang=zh-cn&v=0&rand=' . $this->time . '&signature=' . $signature;
        return $url;
    }


    //执行函数
    public function run($file_path = '', $post = [], $user_arr = [])
    {
        // echo "<script>function a(){window.scrollTo(0, document.body.scrollHeight)};setInterval('a()',1000);</script>";
        // $this->get_congif_mac();
        if (!$file_path && !$user_arr) {
            echo '请选择帐号文件<br>';
            die;
        }
        if ($post['game_type'] == 'bzws') {
            $this->game_type = 'bzws';
        }
        // echo 'run函数';
        //读取文件
        if ($user_arr) {
            $users = $user_arr;
        } elseif ($file_path) {
            $file = file_get_contents($file_path);
            $users = explode("\n", $file);
        } else {
            die(123123);
            $file = file_get_contents("test.txt");
            $users = explode("\n", $file);
        }

        if ($file_path) {
            //验证txt文件第一行的加密字符
            $token = $this->get_congif_mac();
            if (!$token) {
                $mac = $this->mac;
                $set_res = $this->set_congif(['mac' => $mac]);
                if ($set_res > 0) {
                    $token = $mac;
                }
            }
            if (md5(md5($token . 'hjsg')) !== trim($users[0])) {
                echo '复制发给开发者: ' . $this->mac . '<br>';
                // echo '复制到你txt文件第一行: '.md5(md5($this->mac.'hjsg'));
                die;
            }
            unset($users[0]);

            //设置配置项
            if ($post['is_save_config'] > 0) {
                echo '尝试保存配置项</br>';
                $post['mac'] = $token;
                unlink('./congfig' . intval($post['is_save_config']) . '.json');
                unset($post['is_save_config']);
                sleep(1);
                $set_res = $this->set_congif($post);
                unset($post['mac']);
                if ($set_res > 0) {
                    echo '配置项已保存</br>';
                } else {
                    // echo substr(sprintf('%o', fileperms('./congfig.json')), -4);
                    // echo dirname(__FILE__);
                    // var_dump($set_res,$post);
                    echo '配置项保存失败</br>';
                }
            }
        }

        // $this->get_ip();
        $this->user_arr = $users;
        foreach ($users as $kkk => $user) {
            $user = explode(',', $user);
            //实名
            if ($post['activationcode_identification']) {
                $this->user_identification($user[0]);
                continue;
            }
            //登录
            $this->login0($user[0], $user[1], (int)$user[2]);
            $this->login($user[0], $user[1], (int)$user[2]);
            echo $user[0] . '登录成功</br>';
            $this->member_info = $this->member();

            //自动识别活动
            if ($post['auto_action']) {
                $str = '自动获取活动,本期精彩活动有:';
                foreach ($this->auto_action as $action_name => $action_value) {
                    if (in_array($action_name, $this->member_info) && $this->member_info[$action_name] == 1) {
                        $str .= $action_name . ',';
                        if (is_array($action_value)) {
                            foreach ($action_value as $function_name => $function_param) {
                                if (is_array($function_param)) {
                                    for ($i = 0; $i < count($function_param); $i++) {
                                        $post[$function_name][$i] = $function_param[$i];
                                    }
                                } else {
                                    $post[$function_param] = 1;
                                }
                            }
                        } else {
                            $post[$action_value] = 1;
                        }
                    }
                }
                echo $str . '</br>';
            }

            //解锁二级密码,如果有
            // if($user[3]){
            //  $this->member_resource_unlock($user[3]);
            // }

            //切换偃月阵方案3
            if ($post['matrix_use_case'] && !$post[$user[0] . (int)$user[2]]['matrix_use_case']) {
                $this->matrix_use_case(7, 3);
                $_POST[$user[0] . (int)$user[2]]['matrix_use_case'] = 1;
            }
            //开启星宫
            if ($post['star_open_secret'] && !$post[$user[0] . (int)$user[2]]['star_open_secret']) {
                $this->star_open_secret();
                $_POST[$user[0] . (int)$user[2]]['star_open_secret'] = 1;
            }
            //疆域纷争-申请势力
            if ($post['territory_force_list'][0] && !$post[$user[0] . (int)$user[2]]['territory_force_list']) {
                $this->territory_force_list($post['territory_force_list'][1]);
                $_POST[$user[0] . (int)$user[2]]['territory_force_list'] = 1;
            }
            //金银洞
            if ($post['jin_yin_dong'][0] && !$post[$user[0] . (int)$user[2]]['jin_yin_dong']) {
                $id = $this->jin_yin_dong();
                $num = (int)$post['jin_yin_dong'][1];
                $num100 = floor($num / 100);
                $num50 = floor(($num - ($num100 * 100)) / 50);
                $num10 = floor(($num - ($num100 * 100) - ($num50 * 50)) / 10);
                $num5 = floor(($num - ($num100 * 100) - ($num50 * 50) - ($num10 * 10)) / 5);
                // var_dump($num100,$num50,$num10,$num5);die;
                if ($num100 > 0) {
                    for ($i = 0; $i < $num100; $i++) {
                        $this->island_sweep($id, 100);
                    }
                }
                if ($num50 > 0) {
                    for ($i = 0; $i < $num50; $i++) {
                        $this->island_sweep($id, 50);
                    }
                }
                if ($num10 > 0) {
                    for ($i = 0; $i < $num10; $i++) {
                        $this->island_sweep($id, 10);
                    }
                }
                if ($num5 > 0) {
                    for ($i = 0; $i < $num5; $i++) {
                        $this->island_sweep($id, 5);
                    }
                }
                $_POST[$user[0] . (int)$user[2]]['jin_yin_dong'] = 1;
                echo '金银洞打完</br>';
            }
            //招兵买马签到
            if ($post['recruit_followers_index'] && !$post[$user[0] . (int)$user[2]]['recruit_followers_index']) {
                $this->recruit_followers_index();
                $_POST[$user[0] . (int)$user[2]]['recruit_followers_index'] = 1;
            }
            //小黑屋
            if ($post['prison'][0] && !$post[$user[0] . (int)$user[2]]['prison']) {
                $this->prison($post['prison'][1]);
                $_POST[$user[0] . (int)$user[2]]['prison'] = 1;
            }
            //地下城,true扫荡 false无脑往后推
            if ($post['undercity_index'][0] && !$post[$user[0] . (int)$user[2]]['undercity_index']) {
                $this->undercity_index($post['undercity_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['undercity_index'] = 1;
            }
            //神兵图录
            if ($post['god_weapon_catalog_index'][0] && !$post[$user[0] . (int)$user[2]]['god_weapon_catalog_index']) {
                $this->god_weapon_catalog_index($post['god_weapon_catalog_index'][1], $post['god_weapon_catalog_index'][2], $post['god_weapon_catalog_index'][3]);
                $_POST[$user[0] . (int)$user[2]]['god_weapon_catalog_index'] = 1;
            }
            //新宝物抽奖
            if ($post['new_treasure_lottery'] && !$post[$user[0] . (int)$user[2]]['new_treasure_lottery']) {
                $this->new_treasure_lottery();
                $_POST[$user[0] . (int)$user[2]]['new_treasure_lottery'] = 1;
            }
            //世界boss
            if ($post['world_boss_action'] && !$post[$user[0] . (int)$user[2]]['world_boss_action']) {
                $this->world_boss_action();
                $this->world_boss_get_harm_reward();
                $_POST[$user[0] . (int)$user[2]]['world_boss_action'] = 1;
            }
            //将魂星路,参数1:星域名称,参数2:第几关;都不填写无脑往后推
            if ($post['tower_get_scene_list'][0] && !$post[$user[0] . (int)$user[2]]['tower_get_scene_list']) {
                $this->tower_get_scene_list($post['tower_get_scene_list'][1], $post['tower_get_scene_list'][2], $post['tower_get_scene_list'][3]);
                $_POST[$user[0] . (int)$user[2]]['tower_get_scene_list'] = 1;
            }
            //将魂星路-买次数
            if ($post['tower_buy'][0] && !$post[$user[0] . (int)$user[2]]['tower_buy']) {
                $this->tower_buy($post['tower_buy'][1], 1);
                $_POST[$user[0] . (int)$user[2]]['tower_buy'] = 1;
            }
            //神武-神铸
            if ($post['god_martial_art_divine_casting'] && !$post[$user[0] . (int)$user[2]]['god_martial_art_divine_casting']) {
                $this->god_martial_art_divine_casting();
                $this->god_martial_art_receive_divine_casting_reward();
                $_POST[$user[0] . (int)$user[2]]['god_martial_art_divine_casting'] = 1;
            }
            //愿者上钩
            if ($post['fishing'][0] && !$post[$user[0] . (int)$user[2]]['fishing']) {
                $this->fishing($post['fishing'][1]);
                $_POST[$user[0] . (int)$user[2]]['fishing'] = 1;
            }
            //每日通商
            if ($post['business_index'] && !$post[$user[0] . (int)$user[2]]['business_index']) {
                $this->business_index();
                $_POST[$user[0] . (int)$user[2]]['business_index'] = 1;
            }
            //神将之门 参数:第几关,不填无脑往后推
            if ($post['generaltask_index'][0] && !$post[$user[0] . (int)$user[2]]['generaltask_index']) {
                $this->generaltask_index($post['generaltask_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['generaltask_index'] = 1;
            }
            //英雄王座-买次数
            if ($post['herothrone_buy_times'][0] && !$post[$user[0] . (int)$user[2]]['herothrone_buy_times']) {
                $this->herothrone_buy_times($post['herothrone_buy_times'][1]);
                $_POST[$user[0] . (int)$user[2]]['herothrone_buy_times'] = 1;
            }
            //英雄王座
            if ($post['herothrone_start'] && !$post[$user[0] . (int)$user[2]]['herothrone_start']) {
                $this->herothrone_start();
                $_POST[$user[0] . (int)$user[2]]['herothrone_start'] = 1;
            }
            //四象圣域 参数1:要扫荡的名字 参数:要扫荡的关卡;都不填无脑往后推
            if ($post['sanctum_index'][0] && !$post[$user[0] . (int)$user[2]]['sanctum_index']) {
                $this->sanctum_index($post['sanctum_index'][1], $post['sanctum_index'][2], $post['sanctum_index'][3]);
                $_POST[$user[0] . (int)$user[2]]['sanctum_index'] = 1;
            }
            //四象圣域-买次数
            if ($post['sanctum_buy_times'][0] && !$post[$user[0] . (int)$user[2]]['sanctum_buy_times']) {
                $this->sanctum_buy_times($post['sanctum_buy_times'][1], 1);
                $_POST[$user[0] . (int)$user[2]]['sanctum_buy_times'] = 1;
            }
            //四象圣域-奖励*5
            if ($post['sanctum_get_reward'] && !$post[$user[0] . (int)$user[2]]['sanctum_get_reward']) {
                $this->sanctum_get_reward();
                $_POST[$user[0] . (int)$user[2]]['sanctum_get_reward'] = 1;
            }
            //通天塔 参数1:扫荡层数;不填无脑往后推
            if ($post['heaven_index'][0] && !$post[$user[0] . (int)$user[2]]['heaven_index']) {
                $this->heaven_index($post['heaven_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['heaven_index'] = 1;
            }

            //一骑当千 参数1:第几重 参数2:第几关;都不填无脑往后推
            if ($post['assist_copy_index'][0] && !$post[$user[0] . (int)$user[2]]['assist_copy_index']) {
                $this->assist_copy_index($post['assist_copy_index'][1], $post['assist_copy_index'][2]);
                $_POST[$user[0] . (int)$user[2]]['assist_copy_index'] = 1;
            }
            //助阵抽卡
            if ($post['assist_conjure_index'] && !$post[$user[0] . (int)$user[2]]['assist_conjure_index']) {
                $this->assist_conjure_index(true);
                $_POST[$user[0] . (int)$user[2]]['assist_conjure_index'] = 1;
            }
            //白衣渡江,true扫荡 false无脑往后推
            if ($post['awaken_copy_index'][0] && !$post[$user[0] . (int)$user[2]]['awaken_copy_index']) {
                $check = ($post['awaken_copy_index'][2] - 1) * 5 + $post['awaken_copy_index'][3];
                $this->awaken_copy_index($post['awaken_copy_index'][1], $check);
                $_POST[$user[0] . (int)$user[2]]['awaken_copy_index'] = 1;
            }
            //平乱
            if ($post['copies_pk'][0] && !$post[$user[0] . (int)$user[2]]['copies_pk']) {
                $this->copies_sweep_all($post['copies_pk'][1], 1, 1);
                $_POST[$user[0] . (int)$user[2]]['copies_pk'] = 1;
            }
            //祭祀
            if ($post['countrysacrifice_sacrifice_index'][0] && !$post[$user[0] . (int)$user[2]]['countrysacrifice_sacrifice_index']) {
                if ($_POST['game_type'] == 'bzws') {
                    $this->countrysacrifice_action(1);
                } else {
                    $this->countrysacrifice_sacrifice_index($post['countrysacrifice_sacrifice_index'][1]);
                }
                $_POST[$user[0] . (int)$user[2]]['countrysacrifice_sacrifice_index'] = 1;
            }
            //国宴
            if ($post['banquet_index'][0] && !$post[$user[0] . (int)$user[2]]['banquet_index']) {
                $this->banquet_index($post['banquet_index'][1], $post['banquet_index'][2]);
                $_POST[$user[0] . (int)$user[2]]['banquet_index'] = 1;
            }
            //玉楼
            if ($post['jade_tower_index'][0] && !$post[$user[0] . (int)$user[2]]['jade_tower_index']) {
                $this->jade_tower_index($post['jade_tower_index'][1], $post['jade_tower_index'][2], $post['jade_tower_index'][3], $post['jade_tower_index'][4], $post['jade_tower_index'][5], 1, $post['jade_tower_index'][6]);
                $_POST[$user[0] . (int)$user[2]]['jade_tower_index'] = 1;
            }
            //自动觉醒
            if ($post['awaken_index'] && !$post[$user[0] . (int)$user[2]]['awaken_index']) {
                $this->awaken_index();
                $_POST[$user[0] . (int)$user[2]]['awaken_index'] = 1;
            }
            //只买觉醒石
            if ($post['awaken_shop'] && !$post[$user[0] . (int)$user[2]]['awaken_shop']) {
                $this->awaken_shop(true);
                $_POST[$user[0] . (int)$user[2]]['awaken_shop'] = 1;
            }
            //精英扫荡
            if ($post['essence_map_index_sao'][0] && !$post[$user[0] . (int)$user[2]]['essence_map_index_sao']) {
                $this->essence_map_index(true, $post['essence_map_index_sao'][1], $post['essence_map_index_sao'][2]);
                $_POST[$user[0] . (int)$user[2]]['essence_map_index_sao'] = 1;
            }
            //八卦阵
            if ($post['eight_diagram_index'][0] && !$post[$user[0] . (int)$user[2]]['eight_diagram_index']) {
                if (!$_POST[$user[0] . (int)$user[2]]['now_matrix']) {
                    $_POST[$user[0] . (int)$user[2]]['now_matrix'] = $this->matrix_case_index();
                }
                $this->eight_diagram_index($post['eight_diagram_index'][1], $post['eight_diagram_index']);
                echo '打完八卦切回阵法</br>';
                $this->matrix_use_case($_POST[$user[0] . (int)$user[2]]['now_matrix'][0], $_POST[$user[0] . (int)$user[2]]['now_matrix'][1]);
                $_POST[$user[0] . (int)$user[2]]['eight_diagram_index'] = 1;
            }
            //暴走掠夺场掠夺
            if ($post['exploit_tree_loot_index'][0] && !$post[$user[0] . (int)$user[2]]['exploit_tree_loot_index']) {
                $this->exploit_tree_loot_index();
                $this->exploit_stone_loot_index();
                $_POST[$user[0] . (int)$user[2]]['exploit_tree_loot_index'] = 1;
            }
            //暴走掠夺场缉拿
            if ($post['exploit_tree_rank_index'][0] && !$post[$user[0] . (int)$user[2]]['exploit_tree_rank_index']) {
                $this->exploit_tree_rank_index($post['exploit_tree_rank_index'][1]);
                $this->exploit_stone_rank_index($post['exploit_tree_rank_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['exploit_tree_loot_index'] = 1;
            }

            //锦囊妙计
            if ($post['brilliant_idea_index'] && !$post[$user[0] . (int)$user[2]]['brilliant_idea_index']) {
                $this->brilliant_idea_index();
                $_POST[$user[0] . (int)$user[2]]['brilliant_idea_index'] = 1;
            }

            //每日俸禄
            if ($post['country_get_salary'] && !$post[$user[0] . (int)$user[2]]['country_get_salary']) {
                $this->country_get_salary();
                $_POST[$user[0] . (int)$user[2]]['country_get_salary'] = 1;
            }

            //购物盛宴领取每日礼包
            if ($post['gou_wu_sheng_yan'] && !$post[$user[0] . (int)$user[2]]['gou_wu_sheng_yan']) {
                $this->gou_wu_sheng_yan();
                $_POST[$user[0] . (int)$user[2]]['gou_wu_sheng_yan'] = 1;
                echo '购物盛宴已签到</br>';
            }
            //购物盛宴参团
            if ($post['shopping_feast_team_mall'] && !$post[$user[0] . (int)$user[2]]['shopping_feast_team_mall']) {
                $this->shopping_feast_team_mall();
                $_POST[$user[0] . (int)$user[2]]['shopping_feast_team_mall'] = 1;
            }

            //老海外贸易 参数: 0跨服 1本服 
            if ($post['hai_wai_mao_yi'][0] && !$post[$user[0] . (int)$user[2]]['hai_wai_mao_yi']) {
                $this->hai_wai_mao_yi($post['hai_wai_mao_yi'][1], $post['hai_wai_mao_yi'][2]);
                $_POST[$user[0] . (int)$user[2]]['hai_wai_mao_yi'] = 1;
                echo '海外贸易已完成</br>';
            }
            //新海外贸易 参数: 1只报名不等待
            if ($post['newsea_trade_index'][0] && !$post[$user[0] . (int)$user[2]]['newsea_trade_index']) {
                $this->newsea_trade_index([], $post['newsea_trade_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['newsea_trade_index'] = 1;
                echo '新海外贸易已完成</br>';
            }
            //新海外历程
            if ($post['newsea_trade_achieve_index'] && !$post[$user[0] . (int)$user[2]]['newsea_trade_achieve_index']) {
                $this->newsea_trade_achieve_index();
                $_POST[$user[0] . (int)$user[2]]['newsea_trade_achieve_index'] = 1;
            }
            //新海外兑换
            if ($post['newsea_trade_shop_index'] && !$post[$user[0] . (int)$user[2]]['newsea_trade_shop_index']) {
                $this->newsea_trade_shop_index();
                $_POST[$user[0] . (int)$user[2]]['newsea_trade_shop_index'] = 1;
            }

            //宝石矿区 参数: 0默认 1本服 2跨服
            if ($post['mine_mine_now_info'] && !$post[$user[0] . (int)$user[2]]['mine_mine_now_info']) {
                $this->mine_mine_now_info();
                $_POST[$user[0] . (int)$user[2]]['mine_mine_now_info'] = 1;
            }

            //演武榜积分
            if ($post['arena_get_reward'][0] && !$post[$user[0] . (int)$user[2]]['arena_get_reward']) {
                $this->arena_index($post['arena_get_reward'][1]);
                $_POST[$user[0] . (int)$user[2]]['arena_get_reward'] = 1;
            }

            //器械争夺
            if ($post['apparatus_fight_index'][0] && !$post[$user[0] . (int)$user[2]]['apparatus_fight_index']) {
                $this->apparatus_fight_index($post['apparatus_fight_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['apparatus_fight_index'] = 1;
            }

            //采集场
            if ($post['cai_ji_chang'] && !$post[$user[0] . (int)$user[2]]['cai_ji_chang']) {
                $this->cai_ji_chang();
                $_POST[$user[0] . (int)$user[2]]['cai_ji_chang'] = 1;
            }

            //天赋卷轴扫荡
            if ($post['talent_get_info'] && !$post[$user[0] . (int)$user[2]]['talent_get_info']) {
                $this->talent_get_info(1);
                $_POST[$user[0] . (int)$user[2]]['talent_get_info'] = 1;
            }
            //战鼓扫荡
            if ($post['drum_forge_onekey_sweep'] && !$post[$user[0] . (int)$user[2]]['drum_forge_onekey_sweep']) {
                $this->drum_forge_onekey_sweep();
                $_POST[$user[0] . (int)$user[2]]['drum_forge_onekey_sweep'] = 1;
            }
            //丹药扫荡
            if ($post['essence_map_go_sweep_medicine'] && !$post[$user[0] . (int)$user[2]]['essence_map_go_sweep_medicine']) {
                $this->essence_map_go_sweep_medicine();
                $_POST[$user[0] . (int)$user[2]]['essence_map_go_sweep_medicine'] = 1;
            }
            //装备扫荡
            if ($post['zbsd'] && !$post[$user[0] . (int)$user[2]]['zbsd']) {
                $this->zbsd();
                $_POST[$user[0] . (int)$user[2]]['zbsd'] = 1;
            }
            //谏言
            if ($post['expostulation_index'] && !$post[$user[0] . (int)$user[2]]['expostulation_index']) {
                $this->expostulation_index();
                $_POST[$user[0] . (int)$user[2]]['expostulation_index'] = 1;
            }
            //国矿
            if ($post['countrymine_rob'] && !$post[$user[0] . (int)$user[2]]['countrymine_rob']) {
                $this->countrymine_index();
                $_POST[$user[0] . (int)$user[2]]['countrymine_rob'] = 1;
            }

            //每日活动领取
            if ($post['activity_index'] && !$post[$user[0] . (int)$user[2]]['activity_index']) {
                $this->activity_index();
                $_POST[$user[0] . (int)$user[2]]['activity_index'] = 1;
            }

            //注册返礼
            if ($post['rolegift_index'] && !$post[$user[0] . (int)$user[2]]['rolegift_index']) {
                $this->rolegift_index();
                $_POST[$user[0] . (int)$user[2]]['rolegift_index'] = 1;
            }

            //贤才征辟
            if ($post['guess_lantern_riddle_action'] && !$post[$user[0] . (int)$user[2]]['guess_lantern_riddle_action']) {
                $this->guess_lantern_riddle_index();
                $_POST[$user[0] . (int)$user[2]]['guess_lantern_riddle_action'] = 1;
            }
            //贤才征辟-往期奖励
            if ($post['guess_lantern_riddle_receive_rank_reward'] && !$post[$user[0] . (int)$user[2]]['guess_lantern_riddle_receive_rank_reward']) {
                $this->guess_lantern_riddle_receive_rank_reward();
                $_POST[$user[0] . (int)$user[2]]['guess_lantern_riddle_receive_rank_reward'] = 1;
            }

            //铜雀台
            if ($post['beauty_get_beauty_info'][0] && !$post[$user[0] . (int)$user[2]]['beauty_get_beauty_info']) {
                $this->beauty_get_beauty_info($post['beauty_get_beauty_info'][1]);
                $_POST[$user[0] . (int)$user[2]]['beauty_get_beauty_info'] = 1;
            }
            //铜雀台问候
            if ($post['beauty_active_action'] && !$post[$user[0] . (int)$user[2]]['beauty_get_beauty_info']) {
                $this->beauty_active_action($post['beauty_get_beauty_info'][1]);
                $_POST[$user[0] . (int)$user[2]]['beauty_active_action'] = 1;
            }

            //点将台抽卡
            if ($post['general_break_through_draw_card'] && !$post[$user[0] . (int)$user[2]]['general_break_through_draw_card']) {
                $this->general_break_through_draw_index();
                $_POST[$user[0] . (int)$user[2]]['general_break_through_draw_card'] = 1;
            }

            //好友领赠
            if ($post['friend_onekey_receive_give'] && !$post[$user[0] . (int)$user[2]]['friend_onekey_receive_give']) {
                $this->friend_onekey_receive_give();
                $_POST[$user[0] . (int)$user[2]]['friend_onekey_receive_give'] = 1;
            }

            //国家boss
            if ($post['countryboss_index'] && !$post[$user[0] . (int)$user[2]]['countryboss_index']) {
                $this->countryboss_index();
                $_POST[$user[0] . (int)$user[2]]['countryboss_index'] = 1;
            }
            //国家boss-领奖
            if ($post['countryboss_get_reward'] && !$post[$user[0] . (int)$user[2]]['countryboss_get_reward']) {
                $this->countryboss_get_reward(1);
                $_POST[$user[0] . (int)$user[2]]['countryboss_get_reward'] = 1;
            }

            //夜袭乌巢
            if ($post['night_attack_nest_plunder_team'] && !$post[$user[0] . (int)$user[2]]['night_attack_nest_plunder_team']) {
                $this->night_attack_nest_plunder_team(33);
                $_POST[$user[0] . (int)$user[2]]['night_attack_nest_plunder_team'] = 1;
            }

            //征战八方
            if ($post['act_fight_index'][0] && !$post[$user[0] . (int)$user[2]]['act_fight_index']) {
                $this->act_fight_index($post['act_fight_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['act_fight_index'] = 1;
            }

            //助力令牌
            if ($post['help_token_index'] && !$post[$user[0] . (int)$user[2]]['help_token_index']) {
                $this->help_token_index();
                $_POST[$user[0] . (int)$user[2]]['help_token_index'] = 1;
            }

            //魔宠探险
            if ($post['magicpet_explore_index'][0] && !$post[$user[0] . (int)$user[2]]['magicpet_explore_index']) {
                $this->magicpet_explore_index();
                $_POST[$user[0] . (int)$user[2]]['magicpet_explore_index'] = 1;
            }
            //新魔宠
            if ($post['new_magicpet_index'][0] && !$post[$user[0] . (int)$user[2]]['new_magicpet_index']) {
                $this->new_magicpet_index($post['new_magicpet_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['new_magicpet_index'] = 1;
            }

            //荣耀战线
            if ($post['glory_front_index'][0] && !$post[$user[0] . (int)$user[2]]['glory_front_index']) {
                $this->glory_front_index($post['glory_front_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['glory_front_index'] = 1;
            }

            //月卡领取
            if ($post['month_fund_get_reward'] && !$post[$user[0] . (int)$user[2]]['month_fund_get_reward']) {
                $this->month_fund_get_reward();
                $_POST[$user[0] . (int)$user[2]]['month_fund_get_reward'] = 1;
            }
            //征战东瀛
            if ($post['japan_index'] && !$post[$user[0] . (int)$user[2]]['japan_index']) {
                $this->japan_index();
                $_POST[$user[0] . (int)$user[2]]['japan_index'] = 1;
            }

            //结义
            if ($post['jieyi'] && !$post[$user[0] . (int)$user[2]]['jieyi']) {
                $this->sworn_capture();
                $this->sworn_crops_info();
                $this->sworn_smelt();
                $_POST[$user[0] . (int)$user[2]]['jieyi'] = 1;
            }
            //买卖水果
            if ($post['sworn_sell_index'][0] && !$post[$user[0] . (int)$user[2]]['sworn_sell_index']) {
                $this->sworn_sell_index($post['sworn_sell_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['sworn_sell_index'] = 1;
            }
            //势力商店
            if ($post['territory_shop'][0] && !$post[$user[0] . (int)$user[2]]['territory_shop']) {
                $this->territory_shop($post['territory_shop'][1]);
                $_POST[$user[0] . (int)$user[2]]['territory_shop'] = 1;
            }

            //国家商店
            if ($post['country_taxes_shop_index'][0] && !$post[$user[0] . (int)$user[2]]['country_taxes_shop_index']) {
                $this->country_taxes_shop_index($post['country_taxes_shop_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['country_taxes_shop_index'] = 1;
            }

            //刷新每日登陆转盘为元宝
            if ($post['lottery_index'] && !$post[$user[0] . (int)$user[2]]['lottery_index']) {
                $this->lottery_index();
                $_POST[$user[0] . (int)$user[2]]['lottery_index'] = 1;
            }
            //一件托管任务
            if ($post['yi_jian_tuo_guan'] && !$post[$user[0] . (int)$user[2]]['yi_jian_tuo_guan']) {
                $this->yi_jian_tuo_guan();
                $this->yi_jian_tuo_guan();
                $this->hitegg_index();
                $_POST[$user[0] . (int)$user[2]]['yi_jian_tuo_guan'] = 1;
                echo '一件托管任务已完成</br>';
            }


            //藏宝图
            if ($post['treasuremap_index'] && !$post[$user[0] . (int)$user[2]]['treasuremap_index']) {
                $this->treasuremap_index();
                $_POST[$user[0] . (int)$user[2]]['treasuremap_index'] = 1;
            }

            //幸运大比拼
            if ($post['luck_pk_index'] && !$post[$user[0] . (int)$user[2]]['luck_pk_index']) {
                $this->luck_pk_index();
                $_POST[$user[0] . (int)$user[2]]['luck_pk_index'] = 1;
            }

            //三维培养 参1:武将名称 参2-4:武力 智力 体力是否培养,1培养 0不培养
            if ($post['cultivate'][0] && !$post[$user[0] . (int)$user[2]]['cultivate']) {
                $this->cultivate($post['cultivate'][1], $post['cultivate'][2], $post['cultivate'][3], $post['cultivate'][4]);
                $_POST[$user[0] . (int)$user[2]]['cultivate'] = 1;
            }

            //黑市买军令或者初级突飞
            if ($post['blackmarket'][0] && !$post[$user[0] . (int)$user[2]]['blackmarket']) {
                $this->blackmarket();
                $_POST[$user[0] . (int)$user[2]]['blackmarket'] = 1;
            }

            //收集厂掠夺
            if ($post['shouji_lueduo'][0] && !$post[$user[0] . (int)$user[2]]['shouji_lueduo']) {
                $this->shouji_lueduo($post['shouji_lueduo'][1], $post['shouji_lueduo'][2]);
                $_POST[$user[0] . (int)$user[2]]['shouji_lueduo'] = 1;
            }

            //折扣狂欢-摇钱树
            if ($post['discount_carnival_cash_cow_index'] && !$post[$user[0] . (int)$user[2]]['discount_carnival_cash_cow_index']) {
                $this->discount_carnival_cash_cow_index();
                $_POST[$user[0] . (int)$user[2]]['discount_carnival_cash_cow_index'] = 1;
            }
            //折扣狂欢-每日签到
            if ($post['discount_carnival_sign_index'] && !$post[$user[0] . (int)$user[2]]['discount_carnival_sign_index']) {
                $this->discount_carnival_sign_index();
                $_POST[$user[0] . (int)$user[2]]['discount_carnival_sign_index'] = 1;
            }

            //兑换古玉+铜币
            if ($post['actguyu_all'] && !$post[$user[0] . (int)$user[2]]['actguyu_all']) {
                $this->actguyu_all();
                $_POST[$user[0] . (int)$user[2]]['actguyu_all'] = 1;
            }
            //古玉兑换铜币
            if ($post['actguyu'][0] && !$post[$user[0] . (int)$user[2]]['actguyu']) {
                $this->actguyu(34, $post['actguyu'][1]);
                $_POST[$user[0] . (int)$user[2]]['actguyu'] = 1;
            }

            //招财聚宝
            if ($post['actjubao_index'] && !$post[$user[0] . (int)$user[2]]['actjubao_index']) {
                $this->actjubao_index();
                $_POST[$user[0] . (int)$user[2]]['actjubao_index'] = 1;
            }

            //夏日绘卷-属地巡护
            if ($post['four_seasons_picture_patrol_index'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_patrol_index']) {
                $this->four_seasons_picture_patrol_index();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_patrol_index'] = 1;
            }
            //夏日绘卷-凌云阁
            if ($post['four_seasons_picture_cloud_floor_index'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_cloud_floor_index']) {
                $this->four_seasons_picture_cloud_floor_index();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_cloud_floor_index'] = 1;
            }
            //夏日绘卷-凌云阁-盖楼奖励
            if ($post['four_seasons_picture_cloud_floor_achievement_reward_info'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_cloud_floor_achievement_reward_info']) {
                $this->four_seasons_picture_cloud_floor_achievement_reward_info();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_cloud_floor_achievement_reward_info'] = 1;
            }
            //秋日绘卷-丰收季
            if ($post['four_seasons_picture_fruits_index'][0] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_fruits_index']) {
                $this->four_seasons_picture_fruits_index();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_fruits_index'] = 1;
            }
            //秋日绘卷-河蟹肥
            if ($post['four_seasons_picture_crab_index'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_crab_index']) {
                $this->four_seasons_picture_crab_index();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_crab_index'] = 1;
            }
            //秋日绘卷-河蟹肥
            if ($post['four_seasons_picture_grab_red_leaves_entry'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_entry']) {
                $this->four_seasons_picture_grab_red_leaves_entry();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_entry'] = 1;
            }
            //秋日绘卷-夺红叶
            if ($post['four_seasons_picture_grab_red_leaves_index'][0] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_index']) {
                $this->four_seasons_picture_grab_red_leaves_index($post['four_seasons_picture_grab_red_leaves_index'][1], $post['four_seasons_picture_grab_red_leaves_index'][2]);
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_index'] = 1;
            }
            //秋日绘卷-夺红叶-领奖
            if ($post['four_seasons_picture_grab_red_leaves_take_reward'][0] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_take_reward']) {
                $this->four_seasons_picture_grab_red_leaves_take_reward();
                $this->four_seasons_picture_grab_red_leaves_take_final_reward();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_grab_red_leaves_take_reward'] = 1;
            }
            //冬日绘卷-冰糖葫芦
            if ($post['four_seasons_picture_sugar_calabash'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_sugar_calabash']) {
                $this->four_seasons_picture_sugar_calabash();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_sugar_calabash'] = 1;
            }
            //冬日绘卷-打雪仗
            if ($post['four_seasons_picture_snowball_fight'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_snowball_fight']) {
                $this->four_seasons_picture_snowball_fight();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_snowball_fight'] = 1;
            }
            //冬日绘卷-步履薄冰
            if ($post['four_seasons_picture_tread_ice'] && !$post[$user[0] . (int)$user[2]]['four_seasons_picture_tread_ice']) {
                $this->four_seasons_picture_tread_ice();
                $_POST[$user[0] . (int)$user[2]]['four_seasons_picture_tread_ice'] = 1;
            }

            //购物节-超值预购
            if ($post['nineteen_eleven_pre_buy_order'][0] && !$post[$user[0] . (int)$user[2]]['nineteen_eleven_pre_buy_order']) {
                $this->nineteen_eleven_pre_buy_order($post['nineteen_eleven_pre_buy_order'][1]);
                $_POST[$user[0] . (int)$user[2]]['nineteen_eleven_pre_buy_order'] = 1;
            }

            //幸运大转盘
            if ($post['springlottery_index'] && !$post[$user[0] . (int)$user[2]]['springlottery_index']) {
                $this->springlottery_index();
                $_POST[$user[0] . (int)$user[2]]['springlottery_index'] = 1;
            }

            //蹴鞠
            if ($post['act_kemari_index'] && !$post[$user[0] . (int)$user[2]]['act_kemari_index']) {
                $this->act_kemari_index();
                $_POST[$user[0] . (int)$user[2]]['act_kemari_index'] = 1;
            }

            //国家骰子领取
            if ($post['dice'] && !$post[$user[0] . (int)$user[2]]['dice']) {
                $this->dice();
                $_POST[$user[0] . (int)$user[2]]['dice'] = 1;
            }

            //国战报名
            if ($post['siege_join_battle'] && !$post[$user[0] . (int)$user[2]]['siege_join_battle']) {
                $this->siege_join_battle();
                $_POST[$user[0] . (int)$user[2]]['siege_join_battle'] = 1;
            }

            //武斗会报名
            if ($post['war_entry'] && !$post[$user[0] . (int)$user[2]]['war_entry']) {
                $this->war_entry();
                $_POST[$user[0] . (int)$user[2]]['war_entry'] = 1;
            }

            //甜咸之争
            if ($post['quyuan_festival_poll'][0] && !$post[$user[0] . (int)$user[2]]['quyuan_festival_poll']) {
                $this->quyuan_festival_poll($post['quyuan_festival_poll'][1]);
                $_POST[$user[0] . (int)$user[2]]['quyuan_festival_poll'] = 1;
            }
            //甜咸之争奖励领取
            if ($post['quyuan_festival_take_poll'] && !$post[$user[0] . (int)$user[2]]['quyuan_festival_take_poll']) {
                $this->quyuan_festival_take_poll();
                $_POST[$user[0] . (int)$user[2]]['quyuan_festival_take_poll'] = 1;
            }
            //烧艾草
            if ($post['quyuan_festival_burn_grass'] && !$post[$user[0] . (int)$user[2]]['quyuan_festival_burn_grass']) {
                $this->quyuan_festival_burn_grass();
                $_POST[$user[0] . (int)$user[2]]['quyuan_festival_burn_grass'] = 1;
            }

            //赛龙舟-购买次数
            if (($post['go_boating_boat_index'] && $post['go_boating_buy_time'] > 0) && !$post[$user[0] . (int)$user[2]]['go_boating_buy_time']) {
                $this->go_boating_buy_time($post['go_boating_buy_time']);
                $_POST[$user[0] . (int)$user[2]]['go_boating_buy_time'] = 1;
            }
            //赛龙舟
            if ($post['go_boating_boat_index'] && !$post[$user[0] . (int)$user[2]]['go_boating_boat_index']) {
                $this->go_boating_boat_index();
                $_POST[$user[0] . (int)$user[2]]['go_boating_boat_index'] = 1;
            }
            //新版赛龙舟-购买次数
            if (($post['dragon_boat_boat_index'] && $post['dragon_boat_buy_time'] > 0) && !$post[$user[0] . (int)$user[2]]['dragon_boat_buy_time']) {
                $this->dragon_boat_buy_time($post['dragon_boat_buy_time']);
                $_POST[$user[0] . (int)$user[2]]['dragon_boat_buy_time'] = 1;
            }
            //新版赛龙舟
            if ($post['dragon_boat_boat_index'] && !$post[$user[0] . (int)$user[2]]['dragon_boat_boat_index']) {
                $this->dragon_boat_boat_index();
                $_POST[$user[0] . (int)$user[2]]['dragon_boat_boat_index'] = 1;
            }

            //购物狂欢-夺券大赛
            if ($post['twentyyear_shop_draw_ticket_index'] && !$post[$user[0] . (int)$user[2]]['twentyyear_shop_draw_ticket_index']) {
                $this->twentyyear_shop_draw_ticket_index();
                $_POST[$user[0] . (int)$user[2]]['twentyyear_shop_draw_ticket_index'] = 1;
            }
            //购物狂欢-买一送一
            if ($post['twentyyear_shop_buy_free_onece'][0] && !$post[$user[0] . (int)$user[2]]['twentyyear_shop_buy_free_onece']) {
                $this->twentyyear_shop_buy_free_onece($post['twentyyear_shop_buy_free_onece'][1][0], $post['twentyyear_shop_buy_free_onece'][1][1]);
                $_POST[$user[0] . (int)$user[2]]['twentyyear_shop_buy_free_onece'] = 1;
            }

            //新年快乐
            if ($post['newyear_act_index'] && !$post[$user[0] . (int)$user[2]]['newyear_act_index']) {
                $this->newyear_act_index();
                $_POST[$user[0] . (int)$user[2]]['newyear_act_index'] = 1;
            }
            //新年快乐-新春争夺
            if ($post['newyear_act_city_index'] && !$post[$user[0] . (int)$user[2]]['newyear_act_city_index']) {
                $this->newyear_act_city_index();
                $_POST[$user[0] . (int)$user[2]]['newyear_act_city_index'] = 1;
            }

            //双节双庆签到
            if ($post['happy_double_festival_sign_index'] && !$post[$user[0] . (int)$user[2]]['happy_double_festival_sign_index']) {
                $this->happy_double_festival_sign_index();
                $_POST[$user[0] . (int)$user[2]]['happy_double_festival_sign_index'] = 1;
            }
            //双节双庆-国庆探宝
            if ($post['happy_double_festival_treasure_hunter'][0] && !$post[$user[0] . (int)$user[2]]['happy_double_festival_treasure_hunter']) {
                $this->happy_double_festival_treasure_hunter($post['happy_double_festival_treasure_hunter'][1]);
                $_POST[$user[0] . (int)$user[2]]['happy_double_festival_treasure_hunter'] = 1;
            }
            //双节双庆-秘宝兑换
            if ($post['happy_double_festival_buy_shop'][0] && !$post[$user[0] . (int)$user[2]]['happy_double_festival_buy_shop']) {
                $this->happy_double_festival_buy_shop($post['happy_double_festival_buy_shop'][1]);
                $_POST[$user[0] . (int)$user[2]]['happy_double_festival_buy_shop'] = 1;
            }
            //全民翻牌
            if ($post['qm_card_draw'][0] && !$post[$user[0] . (int)$user[2]]['qm_card_draw']) {
                $this->qm_card_draw($post['qm_card_draw'][1]);
                $_POST[$user[0] . (int)$user[2]]['qm_card_draw'] = 1;
            }
            //全民翻牌-兑换
            if ($post['qm_card_action_lottery'][0] && !$post[$user[0] . (int)$user[2]]['qm_card_action_lottery']) {
                $this->qm_card_action_lottery($post['qm_card_action_lottery'][1]);
                $_POST[$user[0] . (int)$user[2]]['qm_card_action_lottery'] = 1;
            }
            //群雄争霸
            if ($post['hero_fight_stage_twodetect'][0] && !$post[$user[0] . (int)$user[2]]['hero_fight_stage_twodetect']) {
                $this->hero_fight_stage_twodetect($post['hero_fight_stage_twodetect'][1]);
                $_POST[$user[0] . (int)$user[2]]['hero_fight_stage_twodetect'] = 1;
            }
            //群雄争霸-押注
            if ($post['hero_fight_arena_index'][0] && !$post[$user[0] . (int)$user[2]]['hero_fight_arena_index']) {
                $this->hero_fight_arena_index($post['hero_fight_arena_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['hero_fight_arena_index'] = 1;
            }
            //群雄争霸-报名
            if ($post['hero_fight_entry'] && !$post[$user[0] . (int)$user[2]]['hero_fight_entry']) {
                $this->hero_fight_entry();
                $_POST[$user[0] . (int)$user[2]]['hero_fight_entry'] = 1;
            }
            //群雄争霸-领奖
            if ($post['hero_fight_reward_index'] && !$post[$user[0] . (int)$user[2]]['hero_fight_reward_index']) {
                $this->hero_fight_reward_index();
                $_POST[$user[0] . (int)$user[2]]['hero_fight_reward_index'] = 1;
            }
            //福从天降-领红包
            if ($post['china_ny_take_red_money'][0] && !$post[$user[0] . (int)$user[2]]['china_ny_take_red_money']) {
                $this->china_ny_take_red_money();
                $_POST[$user[0] . (int)$user[2]]['china_ny_take_red_money'] = 1;
            }
            //福从天降-竞猜
            if ($post['china_ny_bet'][0] && !$post[$user[0] . (int)$user[2]]['china_ny_bet']) {
                $this->china_ny_bet();
                $_POST[$user[0] . (int)$user[2]]['china_ny_bet'] = 1;
            }
            //福从天降-福将目标
            if ($post['china_ny_target_index'][0] && !$post[$user[0] . (int)$user[2]]['china_ny_target_index']) {
                $this->china_ny_target_index();
                $_POST[$user[0] . (int)$user[2]]['china_ny_target_index'] = 1;
            }
            //福从天降-每日签到
            if ($post['china_ny_sign'][0] && !$post[$user[0] . (int)$user[2]]['china_ny_sign']) {
                $this->china_ny_sign();
                $_POST[$user[0] . (int)$user[2]]['china_ny_sign'] = 1;
            }
            //福从天降-竞猜领取
            if ($post['china_ny_take_bet'][0] && !$post[$user[0] . (int)$user[2]]['china_ny_take_bet']) {
                $this->china_ny_take_bet();
                $_POST[$user[0] . (int)$user[2]]['china_ny_take_bet'] = 1;
            }
            //九周年庆-签到
            if ($post['nine_year_sign'] && !$post[$user[0] . (int)$user[2]]['nine_year_sign']) {
                $this->nine_year_sign();
                $this->nine_year_sign_index();
                $_POST[$user[0] . (int)$user[2]]['nine_year_sign'] = 1;
            }
            //周年守护-签到
            if ($post['years_guard_sign_index'] && !$post[$user[0] . (int)$user[2]]['years_guard_sign_index']) {
                $this->years_guard_sign_index();
                $_POST[$user[0] . (int)$user[2]]['years_guard_sign_index'] = 1;
            }

            //七周年庆-签到
            if ($post['seven_year_sign'] && !$post[$user[0] . (int)$user[2]]['seven_year_sign']) {
                $this->seven_year_sign();
                $_POST[$user[0] . (int)$user[2]]['seven_year_sign'] = 1;
            }

            //回馈
            if ($post['vipreward_index'] && !$post[$user[0] . (int)$user[2]]['vipreward_index']) {
                $this->vipreward_index();
                $_POST[$user[0] . (int)$user[2]]['vipreward_index'] = 1;
            }

            //圣诞奇缘
            if ($post['christmas_second'] && !$post[$user[0] . (int)$user[2]]['christmas_second']) {
                $this->christmas_second_letters_index();
                $this->christmas_second_reindeer_fate();
                $this->christmas_second_tree_index();
                $_POST[$user[0] . (int)$user[2]]['christmas_second'] = 1;
            }

            //大亨
            if ($post['national_day_boss_super_boss_reward'][0] && !$post[$user[0] . (int)$user[2]]['national_day_boss_super_boss_reward']) {
                $this->national_day_boss_super_boss_reward($post['national_day_boss_super_boss_reward'][1]);
                $_POST[$user[0] . (int)$user[2]]['national_day_boss_super_boss_reward'] = 1;
            }
            //大亨-出售
            if ($post['national_day_boss_warehouse_index'] && !$post[$user[0] . (int)$user[2]]['national_day_boss_warehouse_index']) {
                $this->national_day_boss_warehouse_index();
                $_POST[$user[0] . (int)$user[2]]['national_day_boss_warehouse_index'] = 1;
            }

            //金鸡报晓
            if ($post['chicken_get_vip_reward'] && !$post[$user[0] . (int)$user[2]]['chicken_get_vip_reward']) {
                $this->chicken_get_vip_reward();
                $_POST[$user[0] . (int)$user[2]]['chicken_get_vip_reward'] = 1;
            }
            //整军
            if ($post['exercise_open_gift'] && !$post[$user[0] . (int)$user[2]]['exercise_open_gift']) {
                $this->exercise_open_gift();
                $_POST[$user[0] . (int)$user[2]]['exercise_open_gift'] = 1;
            }

            //超级团购买银币
            if ($post['big_team_buy_buy'][0] && !$post[$user[0] . (int)$user[2]]['big_team_buy_buy']) {
                $this->big_team_buy_buy($post['big_team_buy_buy'][1]);
                $_POST[$user[0] . (int)$user[2]]['big_team_buy_buy'] = 1;
            }

            //三才比武
            if ($post['three_talents_pk_index'] && !$post[$user[0] . (int)$user[2]]['three_talents_pk_index']) {
                $this->three_talents_pk_index();
                $_POST[$user[0] . (int)$user[2]]['three_talents_pk_index'] = 1;
            }

            //国家争霸-押注
            if ($post['countrys_fight_support_index'][0] && !$post[$user[0] . (int)$user[2]]['countrys_fight_support_index']) {
                $this->countrys_fight_support_index($post['countrys_fight_support_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['countrys_fight_support_index'] = 1;
            }
            //国家争霸-领奖
            if ($post['gjzb'] && !$post[$user[0] . (int)$user[2]]['gjzb']) {
                $this->gjzb();
                $_POST[$user[0] . (int)$user[2]]['gjzb'] = 1;
            }
            //国家争霸-报名
            if ($post['countrys_fight_user_entry'] && !$post[$user[0] . (int)$user[2]]['countrys_fight_user_entry']) {
                $this->countrys_fight_user_entry();
                $_POST[$user[0] . (int)$user[2]]['countrys_fight_user_entry'] = 1;
            }
            //国家争霸-买次数
            if ($post['countrys_fight_buy_victories'] && !$post[$user[0] . (int)$user[2]]['countrys_fight_buy_victories']) {
                $this->countrys_fight_buy_victories();
                $_POST[$user[0] . (int)$user[2]]['countrys_fight_buy_victories'] = 1;
            }

            //茱萸
            if ($post['cornus_index'] && !$post[$user[0] . (int)$user[2]]['cornus_index']) {
                $this->cornus_index();
                $_POST[$user[0] . (int)$user[2]]['cornus_index'] = 1;
            }

            //战神殿
            if ($post['god_index'][0] && !$post[$user[0] . (int)$user[2]]['god_index']) {
                $this->god_index($post['god_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['god_index'] = 1;
            }
            //战神殿报名
            if ($post['god_entry'] && !$post[$user[0] . (int)$user[2]]['god_entry']) {
                $this->god_entry();
                $_POST[$user[0] . (int)$user[2]]['god_entry'] = 1;
            }
            //战神殿领奖
            if ($post['god_get_reward_list'] && !$post[$user[0] . (int)$user[2]]['god_get_reward_list']) {
                $this->god_get_reward_list();
                $_POST[$user[0] . (int)$user[2]]['god_get_reward_list'] = 1;
            }

            //典当行
            if ($post['friend_index'][0] && !$post[$user[0] . (int)$user[2]]['friend_index']) {
                if ($post['friend_index'][3] == 4) {
                    $this->pawn_shop_own_counter_index($post['friend_index'][1]);
                } elseif ($post['friend_index'][3] == 3) {
                    $this->friend_index($post['friend_index'][1], $post['friend_index'][2]);
                } else {
                    $this->chat_read($post['friend_index'][1], $post['friend_index'][2]);
                }
                $_POST[$user[0] . (int)$user[2]]['friend_index'] = 1;
            }

            //道符商店
            if ($post['sorcery_sorcery_exchange_list'][0] && !$post[$user[0] . (int)$user[2]]['sorcery_sorcery_exchange_list']) {
                $this->sorcery_sorcery_exchange_list($post['sorcery_sorcery_exchange_list'][1]);
                $_POST[$user[0] . (int)$user[2]]['sorcery_sorcery_exchange_list'] = 1;
            }

            //战鼓购买
            if ($post['drum_shop_index'] && !$post[$user[0] . (int)$user[2]]['drum_shop_index']) {
                $this->drum_shop_index();
                $this->equip_forge_get_drum_count();
                $_POST[$user[0] . (int)$user[2]]['drum_shop_index'] = 1;
            }
            //成就升级
            if ($post['general_book_get_achievement_list'] && !$post[$user[0] . (int)$user[2]]['general_book_get_achievement_list']) {
                $this->general_book_get_achievement_list();
                $_POST[$user[0] . (int)$user[2]]['general_book_get_achievement_list'] = 1;
            }

            //跨服海外打劫
            if ($post['overseastrade_world_refresh'][0] && !$post[$user[0] . (int)$user[2]]['overseastrade_world_refresh']) {
                $this->overseastrade_world_refresh($post['overseastrade_world_refresh'][1], $post['overseastrade_world_refresh'][2], 1, $post['overseastrade_world_refresh'][3]);
                $_POST[$user[0] . (int)$user[2]]['overseastrade_world_refresh'] = 1;
            }

            //将魂升级
            if ($post['soul_up'][0] && !$post[$user[0] . (int)$user[2]]['soul_up']) {
                $this->soul_up($post['soul_up'][1], $post['soul_up'][2], $post['soul_up'][3], 1);
                $_POST[$user[0] . (int)$user[2]]['soul_up'] = 1;
            }
            //将魂合成
            if ($post['soul_merge_index'][0] && !$post[$user[0] . (int)$user[2]]['soul_merge_index']) {
                $this->soul_merge_index($post['soul_merge_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['soul_merge_index'] = 1;
            }

            //自动喊话
            if ($post['chat_send'][0] && !$post[$user[0] . (int)$user[2]]['chat_send']) {
                $this->chat_send($post['chat_send'][2], $post['chat_send'][1]);
                $_POST[$user[0] . (int)$user[2]]['chat_send'] = 1;
            }

            //自动申请国家
            if ($post['country_search'][0] && !$post[$user[0] . (int)$user[2]]['country_search']) {
                $this->country_search($post['country_search'][1]);
                $_POST[$user[0] . (int)$user[2]]['country_search'] = 1;
            }
            //捐献
            if ($post['country_donate_preview'] && !$post[$user[0] . (int)$user[2]]['country_donate_preview']) {
                $this->country_donate_preview();
                $_POST[$user[0] . (int)$user[2]]['country_donate_preview'] = 1;
            }
            //清气泡
            if ($post['message_update_read_status'] && !$post[$user[0] . (int)$user[2]]['message_update_read_status']) {
                $this->message_update_read_status();
                $_POST[$user[0] . (int)$user[2]]['message_update_read_status'] = 1;
            }

            //激活科技
            if ($post['war_college_use_buff'] && !$post[$user[0] . (int)$user[2]]['war_college_use_buff']) {
                $this->war_college_use_buff();
                $_POST[$user[0] . (int)$user[2]]['war_college_use_buff'] = 1;
            }
            //推图
            if ($post['tui_tu'][0] && !$post[$user[0] . (int)$user[2]]['tui_tu']) {
                $this->tui_tu($post['tui_tu'][1]);
                $_POST[$user[0] . (int)$user[2]]['tui_tu'] = 1;
            }
            //平乱推图
            if ($post['copies_index'] && !$post[$user[0] . (int)$user[2]]['copies_index']) {
                $this->copies_index();
                $_POST[$user[0] . (int)$user[2]]['copies_index'] = 1;
            }

            //精英推图
            if ($post['essence_map_index'] && !$post[$user[0] . (int)$user[2]]['essence_map_index']) {
                $this->essence_map_index();
                $_POST[$user[0] . (int)$user[2]]['essence_map_index'] = 1;
            }

            //太平要数-组队
            if ($post['peace_art_team_hall_index'] && !$post[$user[0] . (int)$user[2]]['peace_art_team_hall_index']) {
                $this->peace_art_team_hall_index();
                $_POST[$user[0] . (int)$user[2]]['peace_art_team_hall_index'] = 1;
            }
            //太平要数-购买次数
            if ($post['peace_art_buy_times'] && !$post[$user[0] . (int)$user[2]]['peace_art_buy_times']) {
                $this->peace_art_buy_times();
                $_POST[$user[0] . (int)$user[2]]['peace_art_buy_times'] = 1;
            }
            //太平要数-攻击
            if ($post['peace_art_index'] && !$post[$user[0] . (int)$user[2]]['peace_art_index']) {
                $this->peace_art_pk();
                $_POST[$user[0] . (int)$user[2]]['peace_art_index'] = 1;
            }

            //提炼星魂
            if ($post['star_refining'][0] && !$post[$user[0] . (int)$user[2]]['star_refining']) {
                $this->star_refining($post['star_refining'][1], 1, $post['star_refining'][2]);
                $_POST[$user[0] . (int)$user[2]]['star_refining'] = 1;
            }
            //购物盛宴-消费3w
            if ($post['shopping_feast_buy_mj'] && !$post[$user[0] . (int)$user[2]]['shopping_feast_buy_mj']) {
                $this->shopping_feast_buy_mj();
                $_POST[$user[0] . (int)$user[2]]['shopping_feast_buy_mj'] = 1;
            }
            //魔宠-消费3w
            if ($post['magicpet_call'] && !$post[$user[0] . (int)$user[2]]['magicpet_call']) {
                $this->magicpet_call_action();
                $_POST[$user[0] . (int)$user[2]]['magicpet_call'] = 1;
            }
            //蓝换突飞
            if ($post['tavern_buy'] && !$post[$user[0] . (int)$user[2]]['tavern_buy']) {
                $this->tavern_buy2();
                $_POST[$user[0] . (int)$user[2]]['tavern_buy'] = 1;
            }
            //神铸
            if ($post['equip_forge_godcast_index'][0] && !$post[$user[0] . (int)$user[2]]['equip_forge_godcast_index']) {
                $this->equip_forge_godcast_index($post['equip_forge_godcast_index'][1], $post['equip_forge_godcast_index'][2], $post['equip_forge_godcast_index'][3], $post['equip_forge_godcast_index'][4], $post['equip_forge_godcast_index'][5], $post['equip_forge_godcast_index'][6]);
                $_POST[$user[0] . (int)$user[2]]['equip_forge_godcast_index'] = 1;
            }
            //新年签到
            if ($post['newyear_sign_sign'] && !$post[$user[0] . (int)$user[2]]['newyear_sign_sign']) {
                $this->newyear_sign_sign();
                $_POST[$user[0] . (int)$user[2]]['newyear_sign_sign'] = 1;
            }
            //玉兔迎春
            if ($post['jaderabbit_receivespring_login_index'] && !$post[$user[0] . (int)$user[2]]['jaderabbit_receivespring_login_index']) {
                $this->jaderabbit_receivespring_login_index();
                $_POST[$user[0] . (int)$user[2]]['jaderabbit_receivespring_login_index'] = 1;
            }
            //扔雪球
            if ($post['snow_ball_index'] && !$post[$user[0] . (int)$user[2]]['snow_ball_index']) {
                $this->snow_ball_index();
                $_POST[$user[0] . (int)$user[2]]['snow_ball_index'] = 1;
            }

            //建业募兵
            if ($post['eight_year_prey_index'][0] && !$post[$user[0] . (int)$user[2]]['eight_year_prey_index']) {
                $this->eight_year_prey_index(explode(' ', $post['eight_year_prey_index'][1]), $post['eight_year_prey_index'][2]);
                $_POST[$user[0] . (int)$user[2]]['eight_year_prey_index'] = 1;
            }
            //建业募兵-全卖
            if ($post['eight_year_sell_index'] && !$post[$user[0] . (int)$user[2]]['eight_year_sell_index']) {
                $this->eight_year_sell_index(1, [], 0, true);
                $_POST[$user[0] . (int)$user[2]]['eight_year_sell_index'] = 1;
            }
            //长安圣谕
            if ($post['eight_year_task_index'] && !$post[$user[0] . (int)$user[2]]['eight_year_task_index']) {
                $this->eight_year_task_index();
                $_POST[$user[0] . (int)$user[2]]['eight_year_task_index'] = 1;
            }
            //邺城求贤
            if ($post['eight_year_consumption_index'][0] && !$post[$user[0] . (int)$user[2]]['eight_year_consumption_index']) {
                $this->eight_year_consumption_index($post['eight_year_consumption_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['eight_year_consumption_index'] = 1;
            }
            //汝南补贴
            if ($post['eight_year_onekey_rebate'] && !$post[$user[0] . (int)$user[2]]['eight_year_onekey_rebate']) {
                $this->eight_year_onekey_rebate();
                $_POST[$user[0] . (int)$user[2]]['eight_year_onekey_rebate'] = 1;
            }
            //八周年刷暗金
            if ($post['eight_year_shop_index'] && !$post[$user[0] . (int)$user[2]]['eight_year_shop_index']) {
                $this->eight_year_shop_index();
                $_POST[$user[0] . (int)$user[2]]['eight_year_shop_index'] = 1;
            }
            //双节双庆-中秋宝盒
            if ($post['happy_double_festival_moon_cake_box'][0] && !$post[$user[0] . (int)$user[2]]['happy_double_festival_moon_cake_box']) {
                $this->happy_double_festival_moon_cake_box($post['happy_double_festival_moon_cake_box'][1], !$post['happy_double_festival_moon_cake_box'][2]);
                $_POST[$user[0] . (int)$user[2]]['happy_double_festival_moon_cake_box'] = 1;
            }
            //购物庆典-代币转盘
            if ($post['act_doubleeleven_lottery_ten'][0] && !$post[$user[0] . (int)$user[2]]['act_doubleeleven_lottery_ten']) {
                $this->act_doubleeleven_lottery_ten($post['act_doubleeleven_lottery_ten'][1]);
                $_POST[$user[0] . (int)$user[2]]['act_doubleeleven_lottery_ten'] = 1;
            }
            //十年庆典
            if ($post['tenyear_celebration_sign_index'] && !$post[$user[0] . (int)$user[2]]['tenyear_celebration_sign_index']) {
                $this->tenyear_celebration_sign_index();
                $_POST[$user[0] . (int)$user[2]]['tenyear_celebration_sign_index'] = 1;
            }
            //11周年
            if ($post['act11th_anniversary_shop_index'][0] && !$post[$user[0] . (int)$user[2]]['act11th_anniversary_shop_index']) {
                $this->act11th_anniversary_shop_index($post['act11th_anniversary_shop_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['act11th_anniversary_shop_index'] = 1;
            }
            //11周年-周年抽奖
            if ($post['act11th_anniversary_lottery'] && !$post[$user[0] . (int)$user[2]]['act11th_anniversary_lottery']) {
                $this->act11th_anniversary_lottery();
                $_POST[$user[0] . (int)$user[2]]['act11th_anniversary_lottery'] = 1;
            }
            //登录返礼
            if ($post['loginreward_index'] && !$post[$user[0] . (int)$user[2]]['loginreward_index']) {
                $this->loginreward_index();
                $_POST[$user[0] . (int)$user[2]]['loginreward_index'] = 1;
            }
            //萌宠探福
            if ($post['act_spring_get_rank'] && !$post[$user[0] . (int)$user[2]]['act_spring_get_rank']) {
                $this->act_spring_get_rank();
                $_POST[$user[0] . (int)$user[2]]['act_spring_get_rank'] = 1;
            }
            //萌宠探福-竞猜
            if ($post['act_spring_gamble_index'][0] && !$post[$user[0] . (int)$user[2]]['act_spring_gamble_index']) {
                $stake = $post['act_spring_gamble_index'][1];
                if (!$stake) {
                    $stake = rand(1, 15000);
                }
                $this->act_spring_gamble_index($stake);
                $_POST[$user[0] . (int)$user[2]]['act_spring_gamble_index'] = 1;
            }
            //萌宠探福-商店
            if ($post['act_spring_shop_index'][0] && !$post[$user[0] . (int)$user[2]]['act_spring_shop_index']) {
                $this->act_spring_shop_index($post['act_spring_shop_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['act_spring_shop_index'] = 1;
            }
            //丹药购买
            if ($post['drug_shop_index'][0] && !$post[$user[0] . (int)$user[2]]['drug_shop_index']) {
                $this->drug_shop_index($post['drug_shop_index'][1], $post['drug_shop_index'][2]);
                $_POST[$user[0] . (int)$user[2]]['drug_shop_index'] = 1;
            }
            //自动升级经脉
            if ($post['drug_index'][0] && !$post[$user[0] . (int)$user[2]]['drug_index']) {
                $this->drug_index($post['drug_index'][1], $post['drug_index'][2], $post['drug_index'][3]);
                $_POST[$user[0] . (int)$user[2]]['drug_index'] = 1;
            }
            //初春青团
            if ($post['spring_outing_mine'][0] && !$post[$user[0] . (int)$user[2]]['spring_outing_mine']) {
                $this->spring_outing_mine($post['spring_outing_mine'][1], $post['spring_outing_mine'][2], $post['spring_outing_mine'][3], $post['spring_outing_mine'][4], $post['spring_outing_mine'][5]);
                $_POST[$user[0] . (int)$user[2]]['spring_outing_mine'] = 1;
            }
            //领红包
            if ($post['act_national_day_index'][0] && !$post[$user[0] . (int)$user[2]]['act_national_day_index']) {
                $this->act_national_day_index();
                $_POST[$user[0] . (int)$user[2]]['act_national_day_index'] = 1;
            }
            //决战(逐鹿)
            if ($post['compete_index'] && !$post[$user[0] . (int)$user[2]]['compete_index']) {
                $this->compete_index();
                $_POST[$user[0] . (int)$user[2]]['compete_index'] = 1;
            }
            //节日礼包
            if ($post['act_holiday_add_login_reward'] && !$post[$user[0] . (int)$user[2]]['act_holiday_add_login_reward']) {
                $this->act_holiday_add_login_reward();
                $_POST[$user[0] . (int)$user[2]]['act_holiday_add_login_reward'] = 1;
            }
            //避暑圣地
            if ($post['summer_resort_index'][0] && !$post[$user[0] . (int)$user[2]]['summer_resort_index']) {
                $this->summer_resort_index(false, $post['summer_resort_index'][1]);
                $_POST[$user[0] . (int)$user[2]]['summer_resort_index'] = 1;
            }
            //夏日庆典-签到
            if ($post['summer_celebration_sign'] && !$post[$user[0] . (int)$user[2]]['summer_celebration_sign']) {
                $this->summer_celebration_sign();
                $_POST[$user[0] . (int)$user[2]]['summer_celebration_sign'] = 1;
            }
            //夏日庆典-纪念称号
            if ($post['summer_celebration_appellation_index'] && !$post[$user[0] . (int)$user[2]]['summer_celebration_appellation_index']) {
                $this->summer_celebration_appellation_index();
                $_POST[$user[0] . (int)$user[2]]['summer_celebration_appellation_index'] = 1;
            }
            //圣诞礼物
            if ($post['christ_present_get_times_index'] && !$post[$user[0] . (int)$user[2]]['christ_present_get_times_index']) {
                $this->christ_present_get_times_index();
                $_POST[$user[0] . (int)$user[2]]['christ_present_get_times_index'] = 1;
            }
            //双旦夺宝-挂
            if ($post['treasure_send_gift_index'] && !$post[$user[0] . (int)$user[2]]['treasure_send_gift_index']) {
                $this->treasure_send_gift_index();
                $_POST[$user[0] . (int)$user[2]]['treasure_send_gift_index'] = 1;
            }
            //双旦夺宝-摘
            if ($post['treasure_pick_index'] && !$post[$user[0] . (int)$user[2]]['treasure_pick_index']) {
                $this->treasure_pick_index();
                $_POST[$user[0] . (int)$user[2]]['treasure_pick_index'] = 1;
            }
            //双旦夺宝-抢
            if ($post['treasure_rob_list'] && !$post[$user[0] . (int)$user[2]]['treasure_rob_list']) {
                $this->treasure_rob_list();
                $_POST[$user[0] . (int)$user[2]]['treasure_rob_list'] = 1;
            }
            //双旦夺宝-夺宝战
            if ($post['treasure_boss_index'] && !$post[$user[0] . (int)$user[2]]['treasure_boss_index']) {
                $this->treasure_boss_index();
                $_POST[$user[0] . (int)$user[2]]['treasure_boss_index'] = 1;
            }
            //12周年庆
            if ($post['act12th_anniversary_activity1_index'] && !$post[$user[0] . (int)$user[2]]['act12th_anniversary_activity1_index']) {
                $this->act12th_anniversary_activity1_index();
                $_POST[$user[0] . (int)$user[2]]['act12th_anniversary_activity1_index'] = 1;
            }
            //藏宝大殿换宝石
            if ($post['countryshop_index'] && !$post[$user[0] . (int)$user[2]]['countryshop_index']) {
                $this->countryshop_index();
                $_POST[$user[0] . (int)$user[2]]['countryshop_index'] = 1;
            }
            //分解宝石
            if ($post['gem_index'] && !$post[$user[0] . (int)$user[2]]['gem_index']) {
                $this->gem_index();
                $_POST[$user[0] . (int)$user[2]]['gem_index'] = 1;
            }
            //新魔宠-开格子
            if ($post['new_magicpet_add_pack'] && !$post[$user[0] . (int)$user[2]]['new_magicpet_add_pack']) {
                $this->new_magicpet_add_pack();
                $_POST[$user[0] . (int)$user[2]]['new_magicpet_add_pack'] = 1;
            }

            unset($users[$kkk]);
            $this->user_arr = $users;
            echo $user[0] . '跑完<hr>';
        }
        echo '所有号都跑完了';
        die;
    }

    //管网实名
    private function user_identification($username)
    {
        $url = 'http://uc.game.zhanchenggame.com/index.php?&c=user&m=identification';
        //暴走的
        if ($this->game_type == 'bzws') {
            $url = 'http://bzws-uc.game.zhanyougame.com/index.php?&c=user&m=identification';
        }
        $arr['username'] = $username;
        $card = $this->get_one_card();
        $arr['name'] = trim($card[0]);
        $arr['id_number'] = trim($card[1]);
        //var_dump($url,$arr);die;

        $res = $this->post($url, $arr, [], 0);
        //$res = json_decode($res,1);
        if ($res['status'] == 1) {
            echo '绑定身份证成功' . $card[0] . ':' . $card[1] . '<br>';
            return 1;
        } else {
            echo '绑定身份证' . $card[0] . ':' . $card[1] . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -6) {
                $this->user_identification($username);
            }
            return 0;
        }
        //echo die;
    }

    //登录(选区那一步获取token_uid,zc有毒)
    private function login0($u, $p, $q)
    {
        $d = date('Y');
        $c = date('n');
        $b = date('j');
        $a = date('w');
        // Math.ceil((D + B + C) * Math.pow(A + 1, A + 1))
        if ($this->game_type == 'bzws') {
            $sign = 'a4c13b9ecf81';
        } else {
            $sign = ceil(($d + $c + $b) * pow($a + 1, $a + 1));
        }
        $signature = md5(md5($this->time) . $sign);
        //hex_md5(hex_md5(xGame.token + xGame.timestamp) + xGame.keynum)
        $url = 'http://uc.game.zhanchenggame.com/index.php?&c=user&m=login&&token=&channel=150&lang=zh-cn&rand=' . $this->time . '&signature=' . $signature;
        // $url = 'http://s' . $q . '.game.zhanchenggame.com/index.php?v=0&c=login&&m=user&&token=&channel=150&lang=zh-cn&rand=' . $this->time . '&signature=' . $signature;
        // var_dump($url);die;
        //暴走的
        if ($this->game_type == 'bzws') {
            $url = 'http://bzws-uc.game.zhanyougame.com/index.php?&c=user&m=login&&token=&channel=9&lang=zh-cn&rand=' . $this->time . '&signature=';
        }
        $arr['u'] = $u;
        $arr['p'] = $p;
        $arr['mac'] = '00:00:00:00:00:00';
        $arr['devicetoken'] = '000000';
        $arr['adid'] = '';
        $arr['token'] = '';
        $arr['channel'] = '150';
        //var_dump($url,$arr);die;

        $res = $this->post($url, $arr, [], 0);
        //$res = json_decode($res,1);
        if ($res['status'] == 1) {
            $this->token_uid = $res['uid'];
        } else {
            echo '登录失败1';
            die;
        }
        //echo die;
    }

    //登录
    private function login($u, $p, $q)
    {
        //$this->bzws_url = 'http://bzws-s'.$q.'.game.zhanyougame.com/index.php';
        $this->bzws_url = 'http://s' . $q . '.game.zhanchenggame.com/index.php';
        //暴走的
        if ($this->game_type == 'bzws') {
            $this->bzws_url = 'http://bzws-s' . $q . '.game.zhanyougame.com/index.php';
        }
        $c['c'] = 'login';
        $c['m'] = 'user';
        //hex_md5(hex_md5(xGame.token + xGame.timestamp) + xGame.keynum)
        $url = $this->transformation_url($c, '');
        $arr['u'] = $u;
        $arr['p'] = $p;
        $arr['mac'] = '00:00:00:00:00:00';
        $arr['devicetoken'] = '000000';
        //$arr['channel'] = '9';
        $arr['channel'] = '150';
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->token = $res['token'];
        } else {
            echo '登录失败';
            die;
        }
        //echo die;
    }

    //快速开始注册
    public function register0($file_path)
    {
        $file = file_get_contents($file_path);
        $users = explode("\n", $file);
        unset($users[0]);
        foreach ($users as $kkk => $u) {
            $user = explode(',', $u);
            // var_dump($user);die;
            $this->register_guest();
            //登录
            $this->login_guest((int)$user[2]);
            $this->register($user[0], $user[1]);
            echo $user[0] . "注册成功<hr>";
        }
        return;
    }

    //快速开始
    private function register_guest()
    {
        // $c['c'] = 'register';
        // $c['m'] = 'guest';
        //hex_md5(hex_md5(xGame.token + xGame.timestamp) + xGame.keynum)
        $url = 'http://uc.game.zhanchenggame.com/index.php?&c=register&m=guest&&token=&channel=150&lang=zh-cn&rand=' . $this->time . '&signature=';
        //暴走的
        if ($this->game_type == 'bzws') {
            $url = 'http://bzws-uc.game.zhanyougame.com/index.php?&c=register&m=guest&&token=&channel=9&lang=zh-cn&rand=' . $this->time . '&signature=';
        }
        //hex_md5(hex_md5(xGame.token + xGame.timestamp) + xGame.keynum)
        // $url = $this->transformation_url($c,'');
        $arr['mac'] = '00:00:00:00:00:00';
        $arr['devicetoken'] = '000000';
        //$arr['channel'] = '9';
        $arr['channel'] = '150';
        $arr['32d7d8f515a95064d2d36ce16330a846'] = '32d7d8f515a95064d2d36ce16330a846';
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->token_uid = $res['uid'];
            echo '快速开始成功';
        } else {
            echo '快速开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            die;
        }
        //echo die;
    }
    //快速开始-登录
    private function login_guest($q)
    {
        //$this->bzws_url = 'http://bzws-s'.$q.'.game.zhanyougame.com/index.php';
        $this->bzws_url = 'http://s' . $q . '.game.zhanchenggame.com/index.php';
        //暴走的
        if ($this->game_type == 'bzws') {
            $this->bzws_url = 'http://bzws-s' . $q . '.game.zhanyougame.com/index.php';
        }
        $c['c'] = 'login';
        $c['m'] = 'guest';
        //hex_md5(hex_md5(xGame.token + xGame.timestamp) + xGame.keynum)
        $url = $this->transformation_url($c, '');
        $arr['mac'] = '00:00:00:00:00:00';
        $arr['devicetoken'] = '000000';
        $arr['uid'] = $this->token_uid;
        $arr['channel'] = '150';
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '登录成功';
            $this->token = $res['token'];
        } else {
            echo '登陆失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            die;
        }
        //echo die;
    }
    //快速开始-绑定
    private function register($u, $p)
    {
        $c['c'] = 'register';
        $c['m'] = 'binding';
        $url = 'http://uc.game.zhanchenggame.com/index.php?&c=register&m=binding&&token=&channel=150&lang=zh-cn&rand=' . $this->time . '&signature=';
        //暴走的
        if ($this->game_type == 'bzws') {
            $url = 'http://bzws-uc.game.zhanyougame.com/index.php?&c=register&m=binding&&token=&channel=9&lang=zh-cn&rand=' . $this->time . '&signature=';
        }
        // $url = $this->transformation_url($c,'');
        $arr['uid'] = $this->token_uid;
        $arr['u'] = $u;
        $arr['p'] = $p;
        $arr['mac'] = '00:00:00:00:00:00';
        $arr['devicetoken'] = '000000';
        $arr['channel'] = '150';
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            // echo '注册成功';
            $this->token_uid = $res['uid'];
        } else {
            // var_dump($res);die;
            echo '注册失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            die;
        }
        //echo die;
    }

    //二级密码解锁
    private function member_resource_unlock($pwd)
    {
        $c['c'] = 'member';
        $c['m'] = 'resource_unlock';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['pwd'] = $pwd;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '二级密码解锁成功</br>';
            return;
        } elseif ($res['status'] == -1) {
            echo '二级密码有误</br>';
            return;
        } else {
            echo '二级密码解锁失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }

    //无脑推图
    private function tui_tu($all_num)
    {
        $member = $this->member();
        if ($member['invasion'] == 1) { //攻城略地
            $this->invasion_index($member['invasion_unit'], 0, $all_num);
        } else { //征战天下
            $res = $this->get_scene_list($member['missionlevel'], 0, $all_num);
        }
        return;
    }

    //读取攻城略地地图
    private function invasion_index($unit, $num, $all_num)
    {
        $c['c'] = 'invasion';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['unit'] = $unit;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->invasion_chapter($res['chapter'], $num, $all_num);
            return 1;
        } else {
            echo '读取攻城略地地图失败:' . $res['msg'] . ',状态码:' . $res['status'] . ';</br>';
            return 0;
        }
    }
    //读取攻城略地详情
    private function invasion_chapter($chapter, $num, $all_num)
    {
        $c['c'] = 'invasion';
        $c['m'] = 'chapter';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['chapter'] = $chapter;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->invasion_challenge($res['mission'], $num, $all_num);
            return 1;
        } else {
            echo '读取攻城略地详情失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //攻城略地-攻击
    private function invasion_challenge($mission_id, $num, $all_num)
    {
        $c['c'] = 'invasion';
        $c['m'] = 'challenge';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mission_id'] = $mission_id;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '击败攻城略地攻击' . $mission_id . '</br>';
                $this->tui_tu($all_num);
                return 1; //赢了
            } else {
                echo '攻城略地攻击' . $mission_id . '失败,请手动调整</br>';
                if ($num < $all_num) {
                    $this->invasion_challenge($mission_id, $num + 1, $all_num);
                }
                return 0; //没打过
            }
            return 1;
        } else {
            echo '攻城略地攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取用户信息
    private function member()
    {
        $c['c'] = 'member';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        echo '读取用户信息</br>';
        //var_dump($res);die;
        if ($res['uid']) {
            $this->token_uid = $res['uid'];
            return $res;
        } else {
            echo '用户信息读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . ';等待3秒重新读取(重复出现请及时关闭代码,避免ip被封)</br>';
            sleep(2);
            $this->member();
            //return 0;
        }
    }

    //读取中地图
    private function get_scene_list($l, $num, $all_num)
    {
        $c['c'] = 'map';
        $c['m'] = 'get_scene_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['l'] = $l;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['status'] == 0) {
                    //进入小地图
                    $get_mission_list = $this->get_mission_list($v['level'], $v['stage'], $num, $all_num);
                    if (!$get_mission_list) {
                        break;
                    }
                }
            }
            $this->get_scene_list($l + 1, $num, $all_num);
            //return 1;
        } else {
            echo '中地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //读取小地图
    private function get_mission_list($l, $s, $num, $all_num)
    {
        $c['c'] = 'map';
        $c['m'] = 'get_mission_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['l'] = $l;
        $arr['s'] = $s;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['status'] == 0) {
                    //攻击
                    $map_action = $this->map_action($v['missionlevel'], $v['missionstage'], $v['missionid'], $num, $all_num);
                    if (!$map_action) {
                        return 0;
                    }
                }
            }
            return 1;
        } else {
            echo '小地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . ';参数:' . $l . '-' . $s . '</br>';
            return 0;
        }
    }

    //攻击关卡
    private function map_action($l, $s, $id, $num, $all_num)
    {
        $c['c'] = 'map';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['l'] = $l;
        $arr['s'] = $s;
        $arr['id'] = $id;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '击败第' . $l . '张中地图的第' . $s . '张小地图的第' . $id . '个怪</br>';
                // if($res['battle']['left_role']['level'] == 91){
                //  echo '到达91级</br>';
                //  return 0;
                // }
                return 1; //赢了
            } else {
                if ($num == 1) {
                    //没打过读一下等级,16级穿装备
                    $member = $this->member();
                    if ($member['level'] == 16) {
                        echo '16级了,上装备</br>';
                        $res0 = $this->general();
                        if ($res0) {
                            $this->tui_tu($all_num);
                        }
                    }
                }
                echo '第' . $l . '张中地图的第' . $s . '张小地图的第' . $id . '个怪攻击失败,请手动调整</br>';
                if ($num < $all_num) {
                    $this->map_action($l, $s, $id, $num + 1, $all_num);
                    return 1;
                } else {
                    return 0;
                }
                // return 0; //没打过
            }
        } else {
            echo '关卡读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . ';参数:' . $l . '-' . $s . '-' . $id . '</br>';
            return 0;
        }
    }

    //读取装备界面信息
    private function general()
    {
        $c['c'] = 'general';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['name'] == '廖化') {
                    $name[1] = '劈山刀';
                    $name[2] = '犀牛宝甲';
                    $name[3] = '苍狼披风';
                    for ($i = 1; $i < 4; $i++) {
                        $res2 = $this->general_get_info($v['id'], $i, $name[$i]);
                        if (!$res2) {
                            echo '穿装备失败,请手动调整,代码停止</br>';
                        }
                    }
                }
            }
            return 1;
        } else {
            echo '装备界面读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //读取将领界面信息
    private function general_get_info($gid, $etype, $name)
    {
        $c['c'] = 'general';
        $c['m'] = 'get_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;
        $arr['etype'] = $etype;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['equipments'] as $v) {
                if ($v['name'] == $name) {
                    return $this->general_equip($res['info']['id'], $v['id'], $etype);
                }
            }
        } else {
            echo '装备界面读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //穿装备
    private function general_equip($gid, $eid, $etype = 1)
    {
        $c['c'] = 'general';
        $c['m'] = 'equip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;
        $arr['eid'] = $eid;
        $arr['etype'] = $etype;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            //顺便一件强化
            $this->strengthen($eid);
            return 1;
        } else {
            echo '装备失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //强化装备
    private function strengthen($gid)
    {
        $c['c'] = 'strengthen';
        $c['m'] = 'onekey_strenthen';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $gid;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '装备强化失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //金银洞列表
    private function jin_yin_dong()
    {
        $c['c'] = 'island';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['gold_list'] as $k => $v) {
                if ($v['killed'] != $v['openstatus'] || $k == 4) {
                    $this->jin_yin_dong2($v['id']);
                    //sleep(0.5);
                }
            }
            return $v['id'];
        } else {
            echo '金银洞列表读取失败</br>';
            return 0;
        }
        //echo die;
    }

    //金银洞详情
    private function jin_yin_dong2($id)
    {
        $c['c'] = 'island';
        $c['m'] = 'get_mission';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['id'] = $id;
        $arr['type'] = 1;
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;

        if ($res['status'] == 1) {
            if ($res['info']['act'] <= 5) {
                //打到15军令
                $this->jin_yin_dong3($res['info']['id']);
                echo '金银洞攻击</br>';
            } else {
                return;
            }
        } else {
            echo '金银洞守卫读取失败</br>';
            return 0;
        }
        //echo die;
    }

    //金银洞开打
    private function jin_yin_dong3($id)
    {
        $c['c'] = 'island';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr, [], 100000);

        if ($res['status'] == 1) {
            //继续打,调用第一步判断打哪了
            $this->jin_yin_dong();
            echo '更新金银洞进度</br>';
        } else {
            echo '金银洞守卫打不过</br>';
            return 0;
        }
        //echo die;
    }
    //金银洞扫荡
    private function island_sweep($id, $times)
    {
        $c['c'] = 'island';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['times'] = $times;
        $res = $this->post($url, $arr, [], 100000);

        if ($res['status'] == 1) {
            echo '金银洞扫荡成功</br>';
        } else {
            echo '金银洞扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
        //echo die;
    }

    //购物盛宴每日签到列表
    private function gou_wu_sheng_yan()
    {
        $c['c'] = 'shopping_feast';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['reward_list'] as $k => $v) {
                if ($v['take_status'] == 1) { //1可领取 2时间没到 3已领取
                    $this->gou_wu_sheng_yan2($v['id']);
                    //sleep(0.5);
                }
            }
        } else {
            echo '购物盛宴每日签到列表获取失败</br>';
            return 0;
        }
    }

    //购物盛宴每日签到领取
    private function gou_wu_sheng_yan2($id)
    {
        $c['c'] = 'shopping_feast';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            return;
        } else {
            echo '购物盛宴每日签到领取失败</br>';
            return 0;
        }
    }
    //购物盛宴-实时团购
    private function shopping_feast_team_mall()
    {
        $c['c'] = 'shopping_feast';
        $c['m'] = 'team_mall';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->shopping_feast_join_team($res['reward_list']['id']);
            return;
        } else {
            echo '购物盛宴-实时团购打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //购物盛宴-参加实时团购
    private function shopping_feast_join_team($id)
    {
        $c['c'] = 'shopping_feast';
        $c['m'] = 'join_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '购物盛宴-实时团购参与成功,当前人数:' . $res['team_buy'] . '</br>';
            return;
        } else {
            echo '购物盛宴-实时团购打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //打开每日登陆抽奖转盘
    private function lottery_index()
    {
        $c['c'] = 'lottery';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开每日登陆抽奖转盘</br>';
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['log']['info']['total_num'] >= 4 && $res['list'][0]['gettype'] != 2) {
                $this->lottery_refresh();
            } else {
                echo '无需刷新;当前抽奖次数:' . $res['log']['info']['total_num'] . ';当前类型:' . $res['list'][0]['gettype'] . '; 1-银币,2-元宝,3-5未知,猜测军令蓝黄,6-紫,7-印,8-突飞</br>';
            }
            return;
        } else {
            echo '每日登陆抽奖转盘打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //刷新每日登陆抽奖转盘
    private function lottery_refresh()
    {
        $c['c'] = 'lottery';
        $c['m'] = 'refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '刷新每日登陆抽奖转盘</br>';
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['list'][0]['gettype'] == 2) {
                echo '转盘已刷新到元宝</br>';
            } else {
                echo '继续刷新,当前类型:' . $res['list'][0]['gettype'] . '; 1-银币,2-元宝,3-5未知,猜测军令蓝黄,6-紫,7-印,8-突飞</br>';
                $this->lottery_refresh();
            }
            return;
        } else {
            echo '每日登陆抽奖转盘刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家祭祀首页
    private function countrysacrifice_sacrifice_index($id = 1)
    {
        $c['c'] = 'countrysacrifice';
        $c['m'] = 'sacrifice_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开国家祭祀</br>';
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['remain_times'] > 0) {
                if ($res['sacrifice_list'][$id - 1]['sacrifice_status'] == 1) {
                    $this->countrysacrifice_sacrifice_start($id);
                } else {
                    echo 'vip等级不足,自动祭祀可祭祀的最高级别</br>';
                    foreach ($res['sacrifice_list'] as $v) {
                        if ($v['sacrifice_status'] == 1) {
                            $id0 = $v['id'];
                        }
                    }
                    $this->countrysacrifice_sacrifice_start($id0);
                }
            } else {
                echo '国家祭祀次数不足</br>';
            }
            return;
        } else {
            echo '国家祭祀打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家祭祀动作
    private function countrysacrifice_sacrifice_start($id)
    {
        $c['c'] = 'countrysacrifice';
        $c['m'] = 'sacrifice_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '国家祭祀成功</br>';
            return;
        } else {
            echo '国家祭祀失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家祭祀动作(暴走)
    private function countrysacrifice_action($id)
    {
        $c['c'] = 'countrysacrifice';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '国家祭祀成功</br>';
            return;
        } else {
            echo '国家祭祀失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //一件托管任务(除了砸金蛋)
    private function yi_jian_tuo_guan()
    {
        $c['c'] = 'trust';
        $c['m'] = 'start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            return;
        } else {
            echo '一件托管任务失败</br>';
            return 0;
        }
    }

    //砸金蛋-首页
    private function hitegg_index()
    {
        $c['c'] = 'hitegg';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '打开砸金蛋</br>';
            foreach ($res['list'] as $v) {
                if ($v['cd'] == 0) {
                    $this->hitegg_hit_egg($v['id']);
                    break;
                }
            }
            return;
        } else {
            echo '砸金蛋-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //砸金蛋-动作
    private function hitegg_hit_egg($id)
    {
        $c['c'] = 'hitegg';
        $c['m'] = 'hit_egg';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '砸金蛋成功</br>';
            return;
        } else {
            echo '砸金蛋失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //海外贸易获取在跑列表
    private function overseastrade_world_refresh($quality, $lv, $page = 1, $time = 0.5)
    {
        $c['c'] = 'overseastrade';
        $c['m'] = 'world_refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['page'] = $page;

        // var_dump($time);die;
        $res = $this->post($url, $arr, [], $time * 1000000);
        if ($res['status'] == 1) {
            foreach ($res['team']['list'] as $v) {
                foreach ($v as $vv) {
                    if ($vv['member1_commodity'] >= $quality && $vv['member2_commodity'] >= $quality && $vv['member1_level'] < $lv && $vv['member2_level'] < $lv) {
                        $has = 1;
                        echo '获取一条信息:' . $vv['member1_name'] . '/Lv.' . $vv['member1_level'] . '/' . $vv['member1_commodity_name'] . ' & ' . $vv['member2_name'] . '/Lv.' . $vv['member2_level'] . '/' . $vv['member2_commodity_name'] . '</br>';
                        $ret = $this->overseastrade_world_rob($vv['id'], $time);
                        if ($ret == -1) {
                            // echo 1;
                            return;
                        }
                    }
                }
            }
            // echo 2;
            if ($res['team']['all_page'] > $page && !$has) {
                echo '当前页没有符合条件的船,查看下一页(当前' . $page . '/' . $res['team']['all_page'] . ')</br>';
                $this->overseastrade_world_refresh($quality, $lv, $page + 1, $time);
                return;
            }
            if (!$has) {
                echo '当前没有符合条件的船,重新查看第一页信息</br>';
                // sleep(1);
            }
            // echo 3;
            $this->overseastrade_world_refresh($quality, $lv, 1, $time);
            return;
        } else {
            if ($res['status'] == -8) {
                $this->overseastrade_world_refresh($quality, $lv, $page, $time);
                return;
            }
            echo '海外贸易获取在跑列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易打劫动作
    private function overseastrade_world_rob($id, $time)
    {
        $c['c'] = 'overseastrade';
        $c['m'] = 'world_rob';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        // authorization = hex_md5("world_rob" + player.info.uid + xGame.robkey + $(this).attr("robid"))
        // authorization = hex_md5("rob" + player.info.uid + xGame.robkey + $(this).attr("robid"))
        $arr['authorization'] = md5("world_rob" . $this->token_uid . "zykj" . $id);

        $res = $this->post($url, $arr, [], $time * 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['win'] > 0) {
                echo '打劫成功</br>';
            } else {
                echo '打劫失败,没打过</br>';
            }
            if ($res['robtimes'] <= 0) {
                echo '次数不足,打劫功能结束</br>';
                return -1;
            }
            return 1;
        } else {
            // echo '<pre>';var_dump($c,$arr,$res);echo '</pre>';
            echo '海外贸易打劫功能失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -11) {
                return 1;
            }
            return 0;
        }
    }

    //新海外 no_buy=不买的商品 only_sign是否只报名
    private function newsea_trade_index($no_buy = [], $only_sign = false)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            // 已知词条
            /**$list = [
                '学者夜观星象发现近期气温回暖',
                '熔炼工艺创新突破',
                '几名游吟诗人前往乡村采风',
                '王城筹备大博物馆',
                '天降大雪，气温骤降',
                '夏日田地迎来收获季',
                '近几日气温已连续突破百年记录',
                '近期有将士探寻古代遗迹',
                '骑士团近期酒文化开始盛行',
                '冬日将近，士兵们开始准备过冬物资',
            ];*/
            // echo '新海外打开成功</br>';
            if ($res['config']['max_sign'] >= $res['sign']['count']) { //还有次数或者进行中
                if ($only_sign) {
                    $this->newsea_trade_sign();
                    return;
                }
                if (!empty($res['sign']['uid'])) { //进行中
                    if (empty($no_buy['ship_refresh_time']) || $no_buy['ship_refresh_time'] != $res['ship_goods']['ship_refresh_time']) {
                        $no_buy = [];
                        $no_buy['ship_refresh_time'] = $res['ship_goods']['ship_refresh_time'];
                    }
                    if (count($res['ship_goods']['goods_detail']) == 0) { //不管是队伍没匹好还是在等待刷新货物
                        echo '新海外等待队伍或刷新中...</br>';
                    } else {
                        //卖出逻辑
                        if (count($res['self_goods']) > 0) {
                            // $desc = '';
                            $all_num = 0;
                            $all_price = 0;
                            foreach ($res['self_goods'] as $goods) {
                                // $desc .= ($goods['total_cost'] / $goods['total_num']).'买'.$goods['desc'] . $goods['total_num'] . '个/';
                                // $desc2 = '';
                                foreach ($res['ship_goods']['goods_detail'] as $buy_goods) {
                                    // $desc2 .= $buy_goods['desc'] . $buy_goods['price'] . '/';

                                    //价格比买入高就售出
                                    if ($goods['goodsid'] == $buy_goods['goodsid'] && ($goods['total_cost'] / $goods['total_num']) < $buy_goods['price'] && $this->newsea_trade_sell($goods['goodsid'], $goods['total_num'])) {
                                        echo '这轮售出赚了' . (($buy_goods['price'] * $goods['total_num']) - $goods['total_cost']) . '</br>';
                                        $no_buy[] = $buy_goods['goodsid'];
                                        $this->newsea_trade_index($no_buy, $only_sign);
                                        return;
                                    }
                                }
                                $all_num += $goods['goods_num'];
                                $all_price += $goods['total_cost'];
                            }
                            // echo '包里' . $desc . '</br>';
                            // echo '商店' . $desc2 . '</br>';
                        }
                        //买入逻辑
                        foreach ($res['ship_goods']['goods_detail'] as $buy) {
                            $max_num = 100 + $res['sign']['expansion_count'] * 100;
                            $buy_num = min(100, $max_num - $all_num, (int)($res['sign']['currency'] /  $buy['price']));
                            // 背包没满才能买入 & 购买数量>0 &不在不买轮次中
                            if ($all_num < $max_num && $buy_num > 0 && !in_array($buy['goodsid'], $no_buy) && $this->newsea_trade_buy($buy['goodsid'], $buy_num)) {
                                echo '单价' . $buy['price'] . '买入' . $buy['desc'] . $buy_num . '个</br>';
                                $this->newsea_trade_index($no_buy, $only_sign);
                                return;
                            }
                        }
                        if ($res['sign']['expansion_count'] < 5 && $res['sign']['currency'] > $res['expansion_cost'][$res['sign']['expansion_count']] + 2001) {
                            $this->newsea_trade_add_package_space();
                        }
                        echo '新海外等待刷新中...当前货币' . $res['sign']['currency'] . ',包里等价' . $all_price . '</br>';
                    }
                } else {
                    if (!$this->newsea_trade_sign()) {
                        return;
                    }
                }
                sleep(5);
                $this->newsea_trade_index($no_buy, $only_sign);
            } else {
                echo '次数不足</br>';
            }
            return 1;
        } else {
            echo '新海外打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-报名
    private function newsea_trade_sign()
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-报名成功</br>';
            return 1;
        } else {
            echo '新海外-报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-买入
    private function newsea_trade_buy($goods_id, $goods_num)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['goods_id'] = $goods_id;
        $arr['goods_num'] = $goods_num;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-买入成功</br>';
            return 1;
        } else {
            echo '新海外-买入失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-卖出
    private function newsea_trade_sell($goods_id, $goods_num)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'sell';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['goods_id'] = $goods_id;
        $arr['goods_num'] = $goods_num;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-卖出成功</br>';
            return 1;
        } else {
            echo '新海外-卖出失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-升级背包
    private function newsea_trade_add_package_space()
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'add_package_space';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-升级背包成功</br>';
            return 1;
        } else {
            echo '新海外-升级背包失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-结束排名
    private function newsea_trade_rank($teamid)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'rank';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['teamid'] = $teamid;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-获取排名成功</br>';
            return 1;
        } else {
            echo '新海外-获取排名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-兑换商店
    private function newsea_trade_shop_index()
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-兑换商店打开成功,当前货币' . $res['trade_currency'] . '</br>';
            $goods_info = array_reverse($res['goods_info']);
            foreach ($goods_info as $v) {
                if ($v['res_type'] == 1 && $v['buy_num'] < $v['buy_limit'] && $res['trade_currency'] >= $v['cost_num']) {
                    $buy_num = min($v['buy_limit'] - $v['buy_num'], (int)($res['trade_currency'] / $v['cost_num']));
                    if ($this->newsea_trade_shop_exchange($v['id'], $buy_num)) {
                        $res['trade_currency'] -= $buy_num * $v['cost_num'];
                    }
                }
            }
            return 1;
        } else {
            echo '新海外-兑换商店打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-兑换
    private function newsea_trade_shop_exchange($id, $buy_num)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'shop_exchange';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['buy_num'] = $buy_num;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '新海外-兑换' . $id . '*' . $buy_num . '成功</br>';
            return 1;
        } else {
            echo '新海外-兑换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-历程
    private function newsea_trade_achieve_index()
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'achieve_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新海外-历程打开成功</br>';
            foreach ($res['detail'] as $v) {
                if ($v['refresh_type'] >= $v['condition']) {
                    if ($this->newsea_trade_achieve_reward($v['id'])) {
                        echo $v['desc'] . '领取成功</br>';
                        $this->newsea_trade_achieve_index();
                    }
                }
            }
            return 1;
        } else {
            echo '新海外-历程打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新海外-历程领取
    private function newsea_trade_achieve_reward($id)
    {
        $c['c'] = 'newsea_trade';
        $c['m'] = 'achieve_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新海外-历程领取' . $id . '成功</br>';
            return 1;
        } else {
            echo '新海外-历程领取' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //海外贸易 第一步获取商城列表
    private function hai_wai_mao_yi($is_benfu = 0, $refresh = 1)
    {
        //要先查看跑船列表,不然被打劫以后不能开下一次船
        echo '打开海外贸易</br>';
        $c0['c'] = 'overseastrade';
        if ($is_benfu) {
            $c0['m'] = 'index';
        } else {
            $c0['m'] = 'world_index';
        }
        $c0['token_uid'] = $this->token_uid;
        $c0['token'] = $this->token;
        $url0 = $this->transformation_url($c0, $this->token);
        $arr0['token'] = $this->token;

        $res0 = $this->post($url0, $arr0);
        if ($res0['endtime']) {
            echo '海外贸易有船在跑,结束时间:' . $res0['endtime'] . '秒</br>';
            return;
        }
        //打开商城列表
        $c['c'] = 'overseastrade';
        if ($is_benfu) {
            $c['m'] = 'goods_list';
        } else {
            $c['m'] = 'world_goods_list';
        }
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['name'] == '普通棉衣') {
                    echo '购买 普通棉衣</br>';
                    //买就对了,不用管之前有没有,有反正会失败,继续执行就ok
                    $ret = $this->hai_wai_mao_yi2($v['id'], $is_benfu);
                }
            }
            if ($refresh == 1) {
                //刷三次船
                for ($i = 0; $i <= 2; $i++) {
                    $this->hai_wai_mao_yi3();
                }
            }
            //打开组队列表并组队
            $this->hai_wai_mao_yi4($is_benfu, 1);
            return;
        } else {
            echo '海外贸易商城读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 第二步购买
    private function hai_wai_mao_yi2($goods_id, $is_benfu)
    {
        $c['c'] = 'overseastrade';
        if ($is_benfu) {
            $c['m'] = 'choose_goods';
        } else {
            $c['m'] = 'choose_world_goods';
        }
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['goods_id'] = $goods_id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {

            return 1;
        } else {
            echo '海外贸易购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 第三步 刷三次船
    private function hai_wai_mao_yi3()
    {
        //读取船列表,判断要不要元宝刷船
        $c0['c'] = 'overseastrade';
        $c0['m'] = 'ship_list';
        $c0['token_uid'] = $this->token_uid;
        $c0['token'] = $this->token;
        $url0 = $this->transformation_url($c0, $this->token);
        $arr0['token'] = $this->token;

        $res0 = $this->post($url0, $arr0);
        if ($res0['price'] > 0) { //花元宝不刷
            echo '海外贸易刷船要花' . $res0['price'] . '元宝,跳过此次刷船</br>';
            return 0;
        }

        $c['c'] = 'overseastrade';
        $c['m'] = 'renovate_ship';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '船只刷新一次</br>';
            return;
        } else {
            echo '海外贸易刷船失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 第4步 打开组队列表
    private function hai_wai_mao_yi4($is_benfu, $page = 3)
    {
        $c['c'] = 'overseastrade';
        if ($is_benfu) {
            $c['m'] = 'get_list_by_country';
        } else {
            $c['m'] = 'get_list_from_world';
        }
        $c['page'] = $page;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '打开海外贸易组队列表</br>';
            //直接占1/3/1的位置(第3页,第一页有傻逼站着不发)
            $site = $place = 1;
            $page = $page;
            $id = 0;
            //判断有无正在组队
            if ($res['list']) {
                ksort($res['list']);
                $bz = 0;
                foreach ($res['list'] as $k1 => $v) {
                    //判断此位置有无人
                    if ($place == $k1) {
                        $place++;
                        if ($place > 4) {
                            echo '第' . $page . '页无空位,尝试打开下一页</br>';
                            $this->hai_wai_mao_yi4($is_benfu, $page + 1);
                            return;
                        }
                    } else {
                        break;
                    }
                }
            } else {
                $site = $place = 1;
                $page = $page;
                $id = 0;
            }

            $this->hai_wai_mao_yi5($site, $page, $place, $is_benfu, $id);
            $this->overseastrade_choose_harbour(1);
            if ($id == 0) {
                if ($is_benfu) {
                    $m = 'start';
                } else {
                    $m = 'world_start';
                }
                $this->overseastrade_start($m);
            } else {
                echo '等待队长发船</br>';
            }
            return;
        } else {
            echo '海外贸易组队列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 第5步 组队动作
    private function hai_wai_mao_yi5($site = 1, $page = 1, $place = 1, $is_benfu, $id = 0)
    {
        $c['c'] = 'overseastrade';
        if ($is_benfu) {
            $c['m'] = 'join_team';
        } else {
            $c['m'] = 'join_world_team';
        }
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['site'] = $site; //1/2号位置
        $arr['page'] = $page; //第几页,基本都是1了
        $arr['place'] = $place; //第几队

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '加入' . $page . '页' . $place . '队' . $site . '位成功</br>';
            return;
        } else {
            // var_dump($site,$page,$place);
            echo '海外贸易加入' . $page . '页' . $place . '队' . $site . '位失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 选择港口
    private function overseastrade_choose_harbour($harbour_id)
    {
        $c['c'] = 'overseastrade';
        $c['m'] = 'choose_harbour';

        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['harbour_id'] = $harbour_id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '港口选择成功</br>';
            return 1;
        } else {
            echo '海外贸易港口选择失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //海外贸易 出发
    private function overseastrade_start($m)
    {
        $c['c'] = 'overseastrade';
        $c['m'] = $m;

        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '海外贸易出发成功</br>';
            return 1;
        } else {
            echo '海外贸易出发失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取可培养将领列表
    private function cultivate($name, $wu = 1, $zhi = 1, $ti = 1)
    {
        $c['c'] = 'cultivate';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $k => $v) {
                if ($v['name'] == $name) {
                    //var_dump($v);die;
                    $wu = $wu ? $v['wuliup'] : null;
                    $zhi = $zhi ? $v['zhiliup'] : null;
                    $ti = $ti ? $v['tiliup'] : null;
                    if ($res['cultivate']) {
                        $this->cultivate_giveup($v['id'], [$wu, $zhi, $ti]);
                    }
                    //培养
                    return $this->cultivate_roll($v['id'], $wu, $zhi, $ti, $v['level']);
                }
            }
        } else {
            echo '可培养将领列表获取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //培养动作
    private function cultivate_roll($gid, $wu, $zhi, $ti, $lv)
    {
        $c['c'] = 'cultivate';
        $c['m'] = 'roll';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;
        $arr['mode'] = 1;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $wuliup = $wu !== null ? $wu - $res['info']['wuliup'] : 0;
            $zhiliup = $zhi !== null ? $zhi - $res['info']['zhiliup'] : 0;
            $tiliup = $ti !== null ? $ti - $res['info']['tiliup'] : 0;

            if (($wuliup + $zhiliup + $tiliup) < 0) {
                $ret = $this->cultivate_save($gid, [$wu, $zhi, $ti]);
                if ($ret) {
                    echo '<span style="color:red;">替换成功:原数值' . $wu . '/' . $zhi . '/' . $ti . ';现数值' . $res['info']['wuliup'] . '/' . $res['info']['zhiliup'] . '/' . $res['info']['tiliup'] . '</span></br>';
                }
            } else {
                $ret = $this->cultivate_giveup($gid, [$wu, $zhi, $ti]);
                if ($ret) {
                    echo '原数值' . $wu . '/' . $zhi . '/' . $ti . ';现数值' . $res['info']['wuliup'] . '/' . $res['info']['zhiliup'] . '/' . $res['info']['tiliup'] . ';不替换</br>';
                }
            }
            //var_dump($ret);die;
            if ($ret) {
                //如果满了
                $w = $z = $t = 0;
                if ($ret[0] !== null) {
                    $w = $ret[0] - 20 >= $lv ? 0 : 1;
                }
                if ($ret[1] !== null) {
                    $z = $ret[1] - 20 >= $lv ? 0 : 1;
                }
                if ($ret[2] !== null) {
                    $t = $ret[2] - 20 >= $lv ? 0 : 1;
                }
                //echo $w . $z . $t.'</br>';
                if ($w || $z || $t) {
                    //只要有一个没满就继续
                    $this->cultivate_roll($gid, $ret[0], $ret[1], $ret[2], $lv);
                }
                return 1;
            } else {
                return 0;
            }
        } else {
            if ($res['status'] == 11 || $res == null) { //操作过快导致
                echo '培养操作过快,等待两秒,重复出现请手动重启代码</br>';
                sleep(2);
                $this->cultivate_roll($gid, $wu, $zhi, $ti, $lv);
                //return;
            }
            var_dump($res);
            echo '培养失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //替换动作
    private function cultivate_save($gid, $arr)
    {
        $c['c'] = 'cultivate';
        $c['m'] = 'save';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr0['token'] = $this->token;
        $arr0['gid'] = $gid;
        $res = $this->post($url, $arr0, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($arr[0] !== null) {
                $arr[0] = $res['info']['wuliup'];
            }
            if ($arr[1] !== null) {
                $arr[1] = $res['info']['zhiliup'];
            }
            if ($arr[2] !== null) {
                $arr[2] = $res['info']['tiliup'];
            }
            return $arr;
        } else {
            if ($res['status'] == 11 || $res == null) { //操作过快导致
                echo '替换操作过快,等待两秒,重复出现请手动重启代码</br>';
                sleep(2);
                $this->cultivate_save($gid, $arr);
                //return;
            }
            var_dump($res);
            echo '替换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //放弃动作
    private function cultivate_giveup($gid, $arr)
    {
        $c['c'] = 'cultivate';
        $c['m'] = 'giveup';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            return $arr;
        } else {
            if ($res['status'] == 11 || $res == null) { //操作过快导致
                echo '放弃操作过快,等待两秒,重复出现请手动重启代码</br>';
                sleep(2);
                $this->cultivate_giveup($gid, $arr);
                //return;
            }
            var_dump($res);
            echo '放弃失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //黑市列表
    private function blackmarket()
    {
        $c['c'] = 'blackmarket';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $k => $v) {
                //type 1银币 2蓝 3黄 4紫 5将 6军令
                //buy_type 1银币 2元宝
                if (($v['type'] == 6 && $v['buy_type'] == 1) || $v['type'] == 2 || $v['type'] == 3 || $v['type'] == 4) { //判断军令且是银币购买
                    //买
                    $this->blackmarket_buy($v['id']);
                }
            }
            //买完以后刷新
            $this->blackmarket_refresh();
        } else {
            echo '黑市列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //黑市购买
    private function blackmarket_buy($id)
    {
        $c['c'] = 'blackmarket';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '黑市购买一次 ';
            foreach ($res['list'] as $k => $v) {
                if (($v['type'] == 6 && $v['buy_type'] == 1) || $v['type'] == 2 || $v['type'] == 3 || $v['type'] == 4) { //判断刚刷出来的东西是军令且是银币购买
                    //买
                    $res = $this->blackmarket_buy($v['id']);
                }
            }
            //防止403重登数量不准,所以动态修改
            if (!$_POST['blackmarket'][2]) { //购买完以后的数量
                $_POST['blackmarket'][2] = $res['all_act'] + $_POST['blackmarket'][1];
            }
            if ($_POST['blackmarket'][2] <= $res['all_act']) {
                echo '黑市军令已完成,现有军令:' . $res['all_act'] . '<br>';
                return 0;
            }
            return 1;
        } elseif (!$res || $res['status'] == 11) {
            echo '黑市购买请求过快,等待5秒 ';
            sleep(5);
            $this->blackmarket();
        } elseif ($res == 403) {
            // echo "<script language=JavaScript> location.replace(location.href);</script>";
            echo '403,15秒后重新登录<br/>';
            sleep(15);
            $test = new demo();
            $res = $test->run('', $_POST, $this->user_arr);
            return;
            // $this->run('',$_POST,$this->user_arr);
        } else {
            var_dump($res);
            echo '黑市购买失败,如果状态码-4=银币不足.-5=元宝不足.-6=蓝不足.-7=黄不足.-8=紫不足.-10=声望不足,返回的状态文字:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //黑市刷新
    private function blackmarket_refresh()
    {
        $c['c'] = 'blackmarket';
        $c['m'] = 'refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '刷新 ';
            $ret = 1;
            foreach ($res['list'] as $k => $v) {
                if (($v['type'] == 6 && $v['buy_type'] == 1) || $v['type'] == 2 || $v['type'] == 3 || $v['type'] == 4) { //判断刚刷出来的东西是军令且是银币购买 或者突飞
                    //买
                    $ret = $this->blackmarket_buy($v['id']);
                }
            }
            if ($ret == 1) {
                //买完以后刷新
                $this->blackmarket_refresh();
                return;
            }
        } else {
            var_dump($res);
            echo '黑市刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //招兵买马
    private function recruit_followers_index()
    {
        //打开招兵买马商城列表
        $c['c'] = 'recruit_followers';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $qiandao = 0;
            foreach ($res['list'] as $k => $v) {
                if ($v['is_franco'] === 1 && $v['is_take'] === 0) {
                    //签到
                    $this->recruit_followers_sign($k);
                    $qiandao = 1;
                    //然后跳出循环(第二个不签,因为每次都签的话最后一天会签不了,要签到的话注释下面一行的break)
                    // break;
                }
            }
            if ($qiandao == 0) {
                echo '招兵买马签到失败,当前没有免费签到</br>';
            }
            return;
        } else {
            echo '招兵买马商城读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //招兵买马签到
    private function recruit_followers_sign($p = 1)
    {
        //打开招兵买马商城列表
        $c['c'] = 'recruit_followers';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '招兵买马签到成功</br>';
            return 1;
        } else {
            echo '招兵买马签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //藏宝图列表
    private function treasuremap_index()
    {
        $c['c'] = 'treasuremap';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['num'] <= 0) {
                echo '藏宝图数量不足</br>';
                return 0;
            }
            $is_ok = 0;
            foreach ($res['list'] as $v) {
                if ($v['quality'] == $res['map']['quality']) {
                    //加入队伍
                    $ret = $this->treasuremap_join_team($v['id']);
                    if ($ret) {
                        $is_ok = 1;
                        //成功以后跳出循环
                        break;
                    }
                }
            }
            if ($is_ok == 0) {
                //说明没有队伍,此时自己创建个队伍
                $this->treasuremap_create_team();
            }
            return;
        } else {
            echo '藏宝图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //藏宝图加入队伍
    private function treasuremap_join_team($id)
    {
        $c['c'] = 'treasuremap';
        $c['m'] = 'join_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['tid'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '藏宝图加入队伍成功</br>';
            return 1;
        } else {
            echo '藏宝图加入队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //藏宝图创建队伍
    private function treasuremap_create_team()
    {
        $c['c'] = 'treasuremap';
        $c['m'] = 'create_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            echo '藏宝图创建队伍成功</br>';
            return 1;
        } else {
            echo '藏宝图创建队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //锦囊妙计
    private function brilliant_idea_index($refresh = true)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        echo '打开锦囊妙计</br>';
        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            $is_pick = 0;
            //个人
            foreach ($res['list']['individual'] as $v) {
                if ($v['dispatch_id']) {
                    echo '领取个人锦囊妙计奖励-' . $v['name'] . '</br>';
                    // $is_pick = 1;
                    $is_pick = $this->brilliant_idea_pick($v['dispatch_id']);
                }
            }
            //团队
            foreach ($res['list']['team'] as $v) {
                if ($v['dispatch_id']) {
                    echo '领取团队锦囊妙计奖励-' . $v['name'] . '</br>';
                    // $is_pick = 1;
                    $is_pick = $this->brilliant_idea_pick($v['dispatch_id']);
                }
            }
            //加速
            if ($res['remain_time'] > 0) {
                foreach ($res['list']['expedite'] as $v) {
                    if ($v['number'] < $v['max_number']) {
                        echo '锦囊妙计-锦囊加速...</br>';
                        $ret = $this->brilliant_idea_expedite($v['id']);
                        if ($ret == 0) {
                            break;
                        }
                    }
                }
            }
            if ($is_pick == 1 || $refresh) {
                echo '有领取奖励,重新打开锦囊妙计</br>';
                $this->brilliant_idea_renovate(1);
                $this->brilliant_idea_renovate(2);
                $this->brilliant_idea_index(false);
            } else {
                //个人
                foreach ($res['list']['individual'] as $v) {
                    if (!$v['dispatch_id']) {
                        echo '打开个人锦囊妙计-' . $v['name'] . '-派遣详情</br>';
                        $this->brilliant_idea_dispatch_preview($v['id'], 1);
                    }
                }
                //团队
                foreach ($res['list']['team'] as $v) {
                    if (!$v['dispatch_id']) {
                        echo '打开团队锦囊妙计-' . $v['name'] . '-派遣详情</br>';
                        $this->brilliant_idea_dispatch_preview($v['id'], 2);
                    }
                }
            }
            return 1;
        } else {
            echo '锦囊妙计打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //锦囊妙计-刷新
    private function brilliant_idea_renovate($idea_type)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'renovate';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['idea_type'] = $idea_type;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            echo '锦囊妙计-刷新</br>';
            return 1;
        } else {
            echo '锦囊妙计-刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //锦囊妙计-派遣详情
    private function brilliant_idea_dispatch_preview($duty_id, $type = 1)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'dispatch_preview';
        $c['duty_id'] = $duty_id;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            $this->brilliant_idea_dispatch($type, $duty_id, $res['duty_info']['general1'], $res['duty_info']['general2'], $res['duty_info']['general3']);
            return 1;
        } else {
            echo '锦囊妙计-派遣详情打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //锦囊妙计-派遣动作
    private function brilliant_idea_dispatch($idea_type, $duty_id, $gid1, $gid2 = null, $gid3 = null)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'dispatch';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['idea_type'] = $idea_type;
        $arr['duty_id'] = $duty_id;
        $arr['gid1'] = $gid1;
        if (!$gid2) {
            $gid2 = 'undefined';
        }
        if (!$gid3) {
            $gid3 = 'undefined';
        }
        $arr['gid2'] = $gid2;
        $arr['gid3'] = $gid3;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '锦囊妙计-派遣成功</br>';
            return 1;
        } else {
            // var_dump($arr);die;
            echo '锦囊妙计-派遣失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //锦囊妙计-领取奖励
    private function brilliant_idea_pick($dispatch_id)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'pick';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['dispatch_id'] = $dispatch_id;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '锦囊妙计-领取奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //锦囊妙计-加速
    private function brilliant_idea_expedite($id)
    {
        $c['c'] = 'brilliant_idea';
        $c['m'] = 'expedite';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '锦囊妙计-加速失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //每日俸禄
    private function country_get_salary()
    {
        $c['c'] = 'country';
        $c['m'] = 'get_salary';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            echo '每日俸禄领取成功</br>';
            return 1;
        } else {
            echo '每日俸禄领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //开启星宫
    private function star_open_secret($palace_id = 1)
    {
        $c['c'] = 'star';
        $c['m'] = 'open_secret';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['palace_id'] = $palace_id;
        $arr['hour'] = 1;
        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '开启星宫成功</br>';
        } else {
            echo '开启星宫失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
        //echo die;
    }

    //小黑屋列表
    private function prison_get_target_list()
    {
        $c['c'] = 'prison';
        $c['m'] = 'get_target_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['random'] as $v) {
                //抢第一个,单纯是为了做任务,输赢不管
                $ret = $this->prison_arrest($v['uid'], $v['country'], 1); //这里的参3是第几个坑位,这里不多做判断,反正一个都抓不到,随便填个1-4就行
                if ($ret['status'] == 1) {
                    echo '小黑屋任务已完成</br>';
                    break;
                }
            }
            return;
        } else {
            echo '小黑屋列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //小黑屋抓捕
    private function prison_arrest($arrest_uid, $arrest_country, $code)
    {
        $c['c'] = 'prison';
        $c['m'] = 'arrest';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['arrest_uid'] = $arrest_uid;
        $arr['arrest_country'] = $arrest_country;
        $arr['code'] = $code;

        $res = $this->post($url, $arr, [], 2500000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            // return $res;
        } elseif ($res['status'] == -9 && $code < 4) {
            $res = $this->prison_arrest($arrest_uid, $arrest_country, $code + 1);
        } else {
            echo '小黑屋抓捕失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
        }
        $res['i'] = $code;
        return $res;
    }
    //小黑屋指定抓人
    private function prison($names = '')
    {
        if ($names) {
            echo '读取好友列表</br>';
            $friend = $this->get_friend_list();
            if ($friend != -1) {
                $name_arr = explode(' ', $names);
                $i = 1;
                foreach ($name_arr as $name) {
                    $uid = 0;
                    if ($i >= 4) {
                        echo '小黑屋牢笼已满</br>';
                    }
                    echo '查询 ' . $name . ' 中</br>';
                    foreach ($friend as $v) {
                        if ($v['nickname'] == $name) {
                            $uid = $v['fuid'];
                            $ret = $this->prison_arrest($v['fuid'], $v['countryid'], $i);
                            $i = $ret['i'];
                            if ($ret['status'] == 1) {
                                if ($ret['assess'] == 1) {
                                    echo $name . ' 已抓捕成功(' . $ret['i'] . '号牢笼)</br>';
                                } else {
                                    echo $name . ' 没打过(可能是被别人抓了),抓捕失败(' . $ret['i'] . '号牢笼)</br>';
                                }
                            }
                            // continue 2;
                        }
                    }
                    if (!$uid) {
                        echo '请先添加 ' . $name . ' 为好友再抓捕(如已添加请确认特殊字符以及有无空格),这样省去了刷Ta的时间,直接打</br>';
                    }
                }
            }
        } else {
            $this->prison_get_target_list();
        }
    }

    //地下城地图列表
    private function undercity_index($is_sao = false)
    { //默认不扫荡往后推
        $c['c'] = 'undercity';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $bz = false;
            foreach ($res['plate_mission'] as $v) {
                if ($v['status'] == 0) {
                    //读取关卡
                    $this->undercity_plate($v['plate'], $v['diff'], $is_sao);
                    $bz = true;
                    break;
                }
            }
            if (!$bz) {
                //说明已通关
                $this->undercity_plate($res['plate_mission'][4]['plate'], $res['plate_mission'][4]['diff'], $is_sao);
            }
            return;
        } else {
            echo '地下城地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //地下城关卡列表
    private function undercity_plate($plate, $diff, $is_sao)
    {
        $c['c'] = 'undercity';
        $c['m'] = 'plate';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['plate'] = $plate;
        $arr['diff'] = $diff;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            // var_dump($is_sao);die;
            if (!$is_sao) {
                // 这里是无脑往后推
                foreach ($res['plate_mission'] as $v) {
                    if ($v['status'] == 0) {
                        //开战
                        $ret = $this->undercity_action($v['id']);
                        break;
                    }
                }
            } else {
                // 这里是扫荡最后能扫荡的那关
                if ($res['times'] < 5) {
                    echo '地下城剩余次数不足5,无法扫荡</br>';
                    return 0;
                }
                $bz = false;
                //倒序数组,扫荡倒序后的第一个能打的关卡
                $plate_mission = array_reverse($res['plate_mission']);
                foreach ($plate_mission as $vv) {
                    if ($vv['status'] == 1) {
                        //扫荡
                        $ret = $this->undercity_sweep($vv['id']);
                        $bz = true;
                        break;
                    }
                }
                if (!$bz) {
                    //说明第一关没打过
                    $ret = $this->undercity_sweep($vv['id'] - 1);
                }
            }

            return;
        } else {
            echo '地下城关卡读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //地下城开战
    private function undercity_action($id)
    {
        $c['c'] = 'undercity';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['win'] > 0) {
                $this->undercity_action($id + 1);
            } else {
                $this->undercity_action($id);
            }
            return 1;
        } else {
            echo '地下城关卡攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //地下城扫荡
    private function undercity_sweep($id)
    {
        $c['c'] = 'undercity';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['type'] = 1;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['five_sub'] == 0) {
                $this->undercity_sweep($id);
            } else {
                echo '地下城关卡' . $id . ' 扫荡完成</br>';
            }
            return 1;
        } else {
            echo '地下城关卡扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //世界boss开战
    private function world_boss_action()
    {
        $c['c'] = 'world_boss';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '世界boss已攻击</br>';
            return;
        } else {
            echo '世界boss攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //世界boss领奖
    private function world_boss_get_harm_reward()
    {
        $c['c'] = 'world_boss';
        $c['m'] = 'get_harm_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '世界boss领奖成功</br>';
            return;
        } else {
            echo '世界boss领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家boss首页
    private function countryboss_index()
    {
        $c['c'] = 'countryboss';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['hit_times'] == 0) {
                echo '国家boss次数不足</br>';
            } else {
                foreach ($res['city_list'] as $v) {
                    if ($v['status'] == 1) {
                        $this->countryboss_join_group($v['city_id']);
                        break;
                    }
                }
            }
            return;
        } else {
            echo '国家boss首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家boss组队
    private function countryboss_join_group($city_id)
    {
        $c['c'] = 'countryboss';
        $c['m'] = 'join_group';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['city_id'] = $city_id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->countryboss_fight();
            return;
        } else {
            echo '国家boss组队失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家boss开战
    private function countryboss_fight()
    {
        $c['c'] = 'countryboss';
        $c['m'] = 'fight';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '国家boss开战成功</br>';
            return;
        } else {
            echo '国家boss开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家boss领奖
    private function countryboss_get_reward($type)
    {
        $c['c'] = 'countryboss';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '国家boss领奖' . $type . '成功</br>';
            if ($type == 1) {
                sleep(3);
                $this->countryboss_get_reward(2);
            }
            return;
        } else {
            echo '国家boss领奖' . $type . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //将魂星路地图列表
    private function tower_get_scene_list($name = '', $id = '', $times = 0)
    { //星域名称,第几关
        $c['c'] = 'tower';
        $c['m'] = 'get_scene_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($name && $id) {
                foreach ($res['scene'] as $v) {
                    if ($v['name'] == $name) {
                        //读取关卡
                        $this->tower_get_mission_list($v['id'], $id, $times);
                        break;
                    }
                }
            } else {
                foreach ($res['scene'] as $v) {
                    if ($v['openstatus'] == 1 && $v['killed'] == 0) {
                        //读取关卡
                        $this->tower_get_mission_list($v['id']);
                        break;
                    }
                }
            }
            return;
        } else {
            echo '将魂星路地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂星路关卡列表
    private function tower_get_mission_list($s, $id = '', $times = 10)
    {
        $c['c'] = 'tower';
        $c['m'] = 'get_mission_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['s'] = $s;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($id) {
                if ($times < 5) {
                    echo '将魂星路' . $times . '次无法扫荡</br>';
                    return;
                }
                if ($res['times'] >= $times) {
                    if ($times >= 5 && $times < 10) {
                        $time = 5;
                    } elseif ($times >= 10 && $times < 50) {
                        $time = 10;
                    } elseif ($times >= 50 && $times < 100) {
                        $time = 50;
                    } else {
                        $time = 100;
                    }
                    //扫荡关卡
                    if ($this->tower_mop_up(($s - 1) * 25 + $id, $time)) {
                        $this->tower_get_mission_list($s, $id, $times - $time);
                    }
                } else {
                    echo '将魂星路扫荡次数不足,剩余次数:' . $res['times'] . '</br>';
                }
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['firstkill'] == 1 && $v['openstatus'] == 1) {
                    //攻击关卡
                    $this->tower_pk($v['id']);
                    break;
                }
            }
            return;
        } else {
            echo '将魂星路关卡读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂星路开战
    private function tower_pk($id)
    {
        $c['c'] = 'tower';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                $this->tower_pk($id + 1);
            } else {
                $this->tower_pk($id);
            }
            return 1;
        } elseif ($res['status'] == 3) {
            echo '将魂星路次数不足</br>';
            return 0;
        } else {
            // var_dump($res);die;
            echo '将魂星路关卡攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂星路扫荡
    private function tower_mop_up($id, $times)
    {
        $c['c'] = 'tower';
        $c['m'] = 'mop_up';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['times'] = $times;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $zhanlipin = 'Lv' . $res['info']['hero_soul']['level'] . $res['info']['hero_soul']['name'] . '*' . $res['info']['hero_soul']['num'];
            echo '将魂星路已扫荡,战利品:元魂 ' . $res['info']['soul'] . '  星魂 ' . $zhanlipin . '</br>';
            return 1;
        } else {
            // var_dump($res);die;
            echo '将魂星路关卡扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂星路买次数
    private function tower_buy($buy_times, $now_times = 0)
    {
        $c['c'] = 'tower';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['type'] = 1;

        $res = $this->post($url, $arr, [], 0);
        // var_dump($id,$num);die;
        if ($res['status'] == 1) {
            echo '将魂星路买次数成功,当前次数:' . $res['times'] . '</br>';
            $now_times += 1;
            if ($buy_times < $now_times) {
                echo '将魂星路买完,共购买' . ($now_times - 1) . '次</br>';
                return;
            }
            $this->tower_buy($buy_times, $now_times);
            return;
        } else {
            echo '将魂星路买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //每日通商列表
    private function business_index()
    {
        $c['c'] = 'business';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 100000);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            $this->business_go_business($res['trader'][0]['id']);
            return;
        } else {
            echo '每日通商列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //每日通商动作
    private function business_go_business($id)
    {
        $c['c'] = 'business';
        $c['m'] = 'go_business';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->business_go_business($res['trader'][0]['id']);
            return;
        } elseif ($res['status'] == 3) {
            echo '每日通商次数不足</br>';
        } else {
            // var_dump($res,$id);
            echo '每日通商失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //神将之门
    private function generaltask_index($id = '')
    { //第几关
        $c['c'] = 'generaltask';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 100000);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            //神将之门列表
            $this->generaltask_get_list($res['list'][0]['id'], $id); //用第一个将领去打
            return;
        } else {
            echo '神将之门读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神将之门列表
    private function generaltask_get_list($gid, $id = '')
    {
        $c['c'] = 'generaltask';
        $c['m'] = 'get_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = 0;

        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($id) {
                $this->generaltask_action($id, 0, $gid, false);
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['firstkill'] == 1) {
                    $this->generaltask_action($v['id'], 0, $gid);
                    break;
                }
            }
            return;
        } else {
            echo '神将之门列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神将之门动作
    private function generaltask_action($id, $type, $gid, $after = true)
    {
        $c['c'] = 'generaltask';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['type'] = $type;
        $arr['gid'] = $gid;

        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($after) {
                if ($res['info']['win'] > 0) {
                    $this->generaltask_action($id + 1, $type, $gid);
                } else {
                    $this->generaltask_action($id, $type, $gid);
                }
            } else {
                $this->generaltask_action($id, $type, $gid, false);
            }
            return;
        } elseif ($res['status'] == -7) {
            echo '神将之门次数不足</br>';
            return;
        } else {
            var_dump($res, $id, $type, $gid);
            echo '神将之门失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //进入英雄王座
    private function herothrone_start()
    {
        //先进入一次王座首页,不然貌似一直返回-2
        $c0['c'] = 'herothrone';
        $c0['m'] = 'index';
        $c0['token_uid'] = $this->token_uid;
        $c0['token'] = $this->token;
        $url0 = $this->transformation_url($c0, $this->token);
        $arr0['token'] = $this->token;

        $res0 = $this->post($url0, $arr0);
        if ($res0['status'] != 1 && $res0['status'] != 3) {
            var_dump($res0);
            echo '英雄王座首页请求失败</br>';
            return;
        }
        if ($res0['status'] == 1 && $res0['info']['times'] == 0 && !$_POST['herothrone_all']) {
            echo '英雄王座今日免费次数已用完</br>';
            return;
        }

        $c['c'] = 'herothrone';
        $c['m'] = 'start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->herothrone_action();
            return;
        } elseif ($res['status'] == -2) {
            // var_dump($res);
            echo '英雄王座次数不足</br>';
            return;
        } else {
            // var_dump($res);
            echo '英雄王座开启失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //英雄王座开战
    private function herothrone_action()
    {
        $c['c'] = 'herothrone';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        echo '英雄王座攻击...</br>';
        $res = $this->post($url, $arr, [], 100000);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                if ($res['battle']['rightteam'][5]['heroid'] == 1100) {
                    $ret = $this->herothrone_end_battle();
                    if ($ret == 1) {
                        // sleep(1);
                        $this->herothrone_start();
                    }
                    return;
                }
                $this->herothrone_action();
            } else {
                $ret = $this->herothrone_end_battle();
                if ($ret == 1) {
                    // sleep(1);
                    $this->herothrone_start();
                }
            }
            return;
        } else {
            echo '英雄王座开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //英雄王座结束
    private function herothrone_end_battle()
    {
        $c['c'] = 'herothrone';
        $c['m'] = 'end_battle';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1 || $res['status'] == -2) {
            echo '英雄王座结束,尝试重置</br>';
            return 1;
        } else {
            echo '英雄王座结束失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //英雄王座买次数
    private function herothrone_buy_times($times)
    {
        //防止403重登数量不准,所以动态修改
        $user_name = explode(',', array_values($this->user_arr)[0])[0];
        if (!$_POST[$user_name . 'herothrone_buy_times']) { //该用户实际购买次数
            $_POST[$user_name . 'herothrone_buy_times'] = 1;
        }
        if ($_POST[$user_name . 'herothrone_buy_times'] > $times) {
            return 0;
        }
        $c['c'] = 'herothrone';
        $c['m'] = 'buy_times';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '英雄王座买次数成功</br>';
            $_POST[$user_name . 'herothrone_buy_times']++;
            $this->herothrone_buy_times($times);
            return 1;
        } else {
            echo '英雄王座买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //四象圣域进度
    private function sanctum_index($s_name = '', $lv = '', $times = '')
    {
        $c['c'] = 'sanctum';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $name['青龙圣域'] = 1;
            $name['玄武圣域'] = 2;
            $name['朱雀圣域'] = 3;
            $name['白虎圣域'] = 4;
            $name['黄麟圣域'] = 5;
            $name['青龙魔域'] = 6;
            $name['玄武魔域'] = 7;
            $name['朱雀魔域'] = 8;
            $name['白虎魔域'] = 9;
            $name['黄麟魔域'] = 10;
            $name['青龙神域'] = 11;
            $name['玄武神域'] = 12;
            $name['朱雀神域'] = 13;
            $name['白虎神域'] = 14;
            $name['黄麟神域'] = 15;
            $name['青龙仙域'] = 16;
            $name['玄武仙域'] = 17;
            $name['朱雀仙域'] = 18;
            $name['白虎仙域'] = 19;
            $name['黄麟仙域'] = 20;
            if ($s_name && $lv) {
                //真实关卡id = 域id*50-50+关卡数
                $lv = ($s_name * 50) - 50 + $lv;
                // var_dump($s_name,$lv);die;
                $this->sanctum_select_map($name[$s_name], $lv, $times);
                return;
            }

            foreach ($res['list'] as $k => $v) {
                if ($v['pass'] == 0) {
                    $this->sanctum_select_map($k);
                    break;
                }
            }
            return;
        } else {
            echo '四象圣域进度读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //四象圣域地图
    private function sanctum_select_map($l, $lv = '', $times = 10)
    {
        $c['c'] = 'sanctum';
        $c['m'] = 'select_map';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['l'] = $l;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            // var_dump($res['times'],$times,$lv);die;
            if ($lv > 0) {
                if ($res['times'] >= $times) {
                    $this->sanctum_action($lv, $times);
                } else {
                    echo '四象圣域扫荡次数不足,当前剩余次数:' . $res['times'] . '</br>';
                }
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['firstkill'] == 1) {
                    $this->sanctum_action($v['id']);
                    break;
                }
            }
            return;
        } else {
            echo '四象圣域地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //四象圣域攻击
    private function sanctum_action($id, $num = '')
    {
        $c['c'] = 'sanctum';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        if ($num) {
            $arr['num'] = $num;
        }

        $res = $this->post($url, $arr);
        // var_dump($res);die;
        if ($res['status'] == 1) {
            if ($num) {
                echo '四象圣域扫荡完成</br>';
                return;
            } else {
                echo '四象圣域-攻击...</br>';
            }
            if ($res['info']['win'] > 0) {
                $this->sanctum_action($id + 1);
            } else {
                $this->sanctum_action($id);
            }
            return;
        } elseif ($res['status'] == -6) {
            echo '四象圣域次数不足</br>';
            return;
        } else {
            echo '四象圣域开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //四象圣域买次数
    private function sanctum_buy_times($buy_times, $now_times = 0)
    {
        $c['c'] = 'sanctum';
        $c['m'] = 'buy_times';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['type'] = 1;

        $res = $this->post($url, $arr, [], 0);
        // var_dump($id,$num);die;
        if ($res['status'] == 1) {
            echo '四象圣域买次数成功,当前次数:' . $res['times'] . '</br>';
            $now_times += 1;
            if ($buy_times < $now_times) {
                echo '四象圣域买完,共购买' . ($now_times - 1) . '次</br>';
                return;
            }
            $this->sanctum_buy_times($buy_times, $now_times);
            return;
        } else {
            echo '四象圣域买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //四象圣域-奖励*5
    private function sanctum_get_reward()
    {
        $c['c'] = 'sanctum';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['type'] = 1;
        $arr['multiple'] = 2;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '四象圣域-奖励*5</br>';
            return;
        } else {
            echo '四象圣域-奖励*5失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //通天塔列表
    private function heaven_index($id = '')
    {
        $c['c'] = 'heaven';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($id) {
                if ($res['times'] >= 10) {
                    $this->heaven_mop_up($id);
                } else {
                    echo '通天塔扫荡次数不足,剩余次数:' . $res['times'] . '</br>';
                }
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['firstkill'] == 1) {
                    $this->heaven_pk($v['id']);
                    break;
                }
            }
            return;
        } else {
            echo '通天塔列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //通天塔动作
    private function heaven_pk($id)
    {
        $c['c'] = 'heaven';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                $this->heaven_pk($id + 1);
            } else {
                $this->heaven_pk($id);
            }
            return;
        } else {
            echo '通天塔攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //通天塔扫荡
    private function heaven_mop_up($id, $num = 10)
    {
        $c['c'] = 'heaven';
        $c['m'] = 'mop_up';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['times'] = $num;

        $res = $this->post($url, $arr);
        // var_dump($id,$num);die;
        if ($res['status'] == 1) {
            echo '通天塔扫荡完成</br>';
            return;
        } else {
            echo '通天塔扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大比拼-首页
    private function luck_pk_index()
    {
        $c['c'] = 'luck_pk';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '幸运大比拼-首页</br>';
            if ($res['remain_times'] > 0) {
                $this->luck_pk_action();
            } else {
                echo '幸运大比拼-次数不足</br>';
            }
            if ($res['box_num'] > 0) {
                $this->luck_pk_receive_luck_box();
            }
            return;
        } else {
            echo '幸运大比拼-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大比拼-动作
    private function luck_pk_action()
    {
        $c['c'] = 'luck_pk';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '转到' . $res['number'] . ',幸运数字' . $res['luck_number'] . '</br>';
            if ($res['remain_times'] > 0) {
                $this->luck_pk_action();
            } else {
                $this->luck_pk_receive_rank_reward();
                $this->luck_pk_index();
            }
            return;
        } else {
            echo '幸运大比拼-抽取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大比拼-大礼包领取
    private function luck_pk_receive_luck_box()
    {
        $c['c'] = 'luck_pk';
        $c['m'] = 'receive_luck_box';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '幸运大比拼-大礼包领取成功</br>';
            return;
        } else {
            echo '幸运大比拼-大礼包领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大比拼-昨日排名
    private function luck_pk_get_rank_info()
    {
        $c['c'] = 'luck_pk';
        $c['m'] = 'get_rank_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '幸运大比拼-昨日排名打开</br>';
            if ($res['old_rank']) {
            }
            return;
        } else {
            echo '幸运大比拼-昨日排名打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大比拼-昨日排名领取
    private function luck_pk_receive_rank_reward()
    {
        $c['c'] = 'luck_pk';
        $c['m'] = 'receive_rank_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '幸运大比拼-昨日排名领取成功</br>';
            return;
        } else {
            echo '幸运大比拼-昨日排名领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //一骑当千地图
    private function assist_copy_index($stage_id = '', $id = '')
    {
        $c['c'] = 'assist_copy';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($stage_id && $id) {
                if ($res['data']['total_remain_times'] >= 5) {
                    $lv = ($stage_id * 15) - 15 + $id;
                    $this->assist_copy_sweep($lv);
                } else {
                    echo '一骑当千扫荡次数不足,剩余次数:' . $res['data']['total_remain_times'] . '</br>';
                }
                return;
            }
            foreach ($res['data']['mission_list'] as $v) {
                if ($v['is_pass'] == 1) {
                    $this->assist_copy_challenge($v['id']);
                    break;
                }
            }
            return;
        } else {
            echo '一骑当千地图读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //一骑当千攻击
    private function assist_copy_challenge($id)
    {
        $c['c'] = 'assist_copy';
        $c['m'] = 'challenge';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mission_id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                $this->assist_copy_challenge($id + 1);
            } else {
                $this->assist_copy_challenge($id);
            }
            return;
        } elseif ($res['status'] == -10) {
            $this->assist_copy_pick_profound_mystery($res['data']['random_mystery'][0]['property_id'], $id);
            return;
        } else {
            // var_dump($res,$id);
            echo '一骑当千开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //一骑当千扫荡
    private function assist_copy_sweep($id)
    {
        $c['c'] = 'assist_copy';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mission_id'] = $id;
        $arr['times'] = 5;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['data']['total_remain_times'] >= 5) {
                $this->assist_copy_sweep($id);
            } else {
                echo '一骑当千扫荡完成</br>';
            }
            return;
        } else {
            // var_dump($res,$id);
            echo '一骑当千扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //一骑当千选择buff
    private function assist_copy_pick_profound_mystery($id, $bz)
    {
        $c['c'] = 'assist_copy';
        $c['m'] = 'pick_profound_mystery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['property_id'] = $id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->assist_copy_challenge($bz);
            return 1;
        } else {
            // var_dump($res,$id);
            echo '一骑当千buff选择失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //助阵抽卡
    private function assist_conjure_index()
    {
        $c['c'] = 'assist_conjure';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['data']['const']['free_times'] <= 0) {
                echo '助阵抽卡次数不足</br>';
                return 0;
            }
            $this->assist_conjure_conjure(1);
            return;
        } else {
            // var_dump($res,$id);
            echo '助阵抽卡打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //抽卡动作
    private function assist_conjure_conjure($conjure_type = 1)
    {
        $c['c'] = 'assist_conjure';
        $c['m'] = 'conjure';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['conjure_type'] = $conjure_type;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '助阵抽卡-小召唤成功</br>';
            return 1;
        } else {
            // var_dump($res,$id);
            echo '助阵抽卡-小召唤失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //白衣渡江列表
    private function awaken_copy_index($is_sao = false, $check = 85)
    {
        $c['c'] = 'awaken_copy';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if (!$is_sao) {
                echo '不扫荡,往后推...</br>';
                foreach ($res['point_info'] as $v) {
                    if ($v['button'] == 1) {
                        $this->awaken_copy_check_index($v['check']);
                        break;
                    }
                }
            } else {
                $point_info = array_reverse($res['point_info']);
                foreach ($point_info as $v) {
                    if ($v['check'] == $check) {
                        if ($v['button'] != 2) {
                            echo '关卡' . $check . '未达成扫荡条件</br>';
                            return;
                        }
                        if ($v['times'] < 5) {
                            echo '关卡' . $check . '次数不足,无法扫荡</br>';
                            return;
                        }
                        $this->awaken_copy_sweep($v['check']);
                        break;
                    }
                }
            }
            return;
        } else {
            echo '白衣渡江列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //白衣渡江地图
    private function awaken_copy_check_index($check)
    {
        $c['c'] = 'awaken_copy';
        $c['m'] = 'check_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['check'] = $check;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '进入关卡' . $check . '</br>';
            foreach ($res['check_info'] as $v) {
                if ($v['button'] == 1) {
                    $ret = $this->awaken_copy_battle($v['check'], $v['point']);
                    if ($v['point'] == count($res['check_info'])) {
                        //最后一个怪
                        $check++;
                    }
                    if ($ret) {
                        $this->awaken_copy_check_index($check);
                    }
                    break;
                }
            }
            return;
        } else {
            echo '白衣渡江列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //白衣渡江攻击
    private function awaken_copy_battle($check, $point)
    {
        $c['c'] = 'awaken_copy';
        $c['m'] = 'battle';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['check'] = $check;
        $arr['point'] = $point;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '白衣渡江开战' . $point . '</br>';
            if ($res['win'] > 0) {
                return 1;
            } else {
                return 2;
            }
        } else {
            echo '白衣渡江开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //白衣渡江扫荡
    private function awaken_copy_sweep($check, $times = 1)
    {
        $c['c'] = 'awaken_copy';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['check'] = $check;
        $arr['times'] = $times;

        echo '白衣渡江扫荡5s后扫荡...</br>';
        $res = $this->post($url, $arr, [], 5000000);
        // var_dump($arr,$res);die;
        if ($res['status'] == 1) {
            $this->awaken_copy_sweep($check--);
            return;
        } else {
            echo '白衣渡江扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //平乱(打第一关第一个怪5次)
    private function copies_pk2($id = 1, $diff_id = 1, $monster_id = 1)
    {
        $c['c'] = 'copies';
        $c['m'] = 'pk';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            $this->copies_pk(1, 1, 1);
        } else {
            // var_dump($res);
            echo '平乱开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //平乱扫荡 
    // stage_type 1普通关卡 2boss关卡 3普通+boss
    // difficulty_type 1普通 2困难 3英雄
    private function copies_sweep_all($stage_type = 2, $difficulty_type = 1, $confirm = 1)
    {
        $c['c'] = 'copies';
        $c['m'] = 'sweep_all';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['stage_type'] = $stage_type;
        $arr['difficulty_type'] = $difficulty_type;
        $arr['confirm'] = $confirm;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '平乱难度' . $difficulty_type . '扫荡成功</br>';
            if ($difficulty_type < 3) {
                $this->copies_sweep_all($stage_type, $difficulty_type + 1, 1);
            }
            return 1;
        } else {
            // var_dump($res);
            echo '平乱难度' . $difficulty_type . '扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -3 && $difficulty_type < 3) {
                $this->copies_sweep_all($stage_type, $difficulty_type + 1, 1);
            }
            return 0;
        }
    }
    //平乱地图列表
    private function copies_index()
    {
        $c['c'] = 'copies';
        $c['m'] = 'index';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['succ'] == 0) {
                    echo '进入平乱 ' . $v['name'] . '</br>';
                    $this->copies_get_monster_list($v['id']);
                }
            }
            return;
        } else {
            echo '平乱地图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //平乱地图
    private function copies_get_monster_list($id)
    {
        $c['c'] = 'copies';
        $c['m'] = 'get_monster_list';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $list) {
                foreach ($list['list'] as $v) {
                    if ($v['killed'] == 0) {
                        echo '攻击平乱 ' . $v['name'] . '</br>';
                        if (!$this->copies_pk($v['copies_id'], $v['diff_id'], $v['monster_id'])) {
                            return;
                        }
                    }
                }
            }
            return;
        } else {
            echo '平乱地图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //攻击平乱
    private function copies_pk($id, $diff_id, $monster_id)
    {
        $c['c'] = 'copies';
        $c['m'] = 'pk';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '胜利</br>';
                return 1;
            } else {
                echo '失败</br>';
                return 0;
            }
        } else {
            echo '平乱地图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //精英地图列表
    private function essence_map_index($is_sao = false, $times = 1, $type = 123)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'index';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($is_sao) {
                    echo '进入精英地图 ' . $v['name'] . '</br>';
                    $this->essence_map_get_monster_list($v['id'], $is_sao, $times, $type);
                } else {
                    if ($v['succ'] == 0) {
                        echo '进入精英地图 ' . $v['name'] . '</br>';
                        $this->essence_map_get_monster_list($v['id'], $is_sao, $times, $type);
                    }
                }
            }
            return;
        } else {
            echo '精英地图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //精英地图
    private function essence_map_get_monster_list($id, $is_sao = false, $times = 1, $type)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'get_monster_list';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $list) {
                foreach ($list['list'] as $v) {
                    if ($is_sao) {
                        $this->essence_map_get_monster_info($v['essence_id'], $v['diff_id'], $v['monster_id'], $times, $type);
                    } else {
                        if ($v['killed'] == 0) {
                            echo '攻击精英 ' . $v['name'] . '</br>';
                            if (!$this->essence_map_pk($v['essence_id'], $v['diff_id'], $v['monster_id'])) {
                                return;
                            }
                        }
                    }
                }
            }
            return;
        } else {
            echo '精英地图列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //攻击精英
    private function essence_map_pk($id, $diff_id, $monster_id)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'pk';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '胜利</br>';
                return 1;
            } else {
                echo '失败</br>';
                return 0;
            }
        } else {
            echo '精英地图攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //精英地图-获取奖励
    private function essence_map_get_monster_info($id, $diff_id, $monster_id, $times, $type)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'get_monster_info';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            switch ($type) {
                case 1:
                    $names = ['蛮荒棉', '蠻荒棉'];
                    break;
                case 2:
                    $names = ['漩涡精华', '漩渦精華'];
                    break;
                case 3:
                    $names = ['奇异精华', '奇異精華'];
                    break;
                case 12:
                    $names = ['蛮荒棉', '蠻荒棉', '漩涡精华', '漩渦精華'];
                    break;
                case 13:
                    $names = ['蛮荒棉', '蠻荒棉', '奇异精华', '奇異精華'];
                    break;
                case 23:
                    $names = ['漩涡精华', '漩渦精華', '奇异精华', '奇異精華'];
                    break;
                case 123:
                    $names = ['蛮荒棉', '蠻荒棉', '漩涡精华', '漩渦精華', '奇异精华', '奇異精華'];
                    break;
                default:
                    $names = 1;
                    break;
            }
            foreach ($res['info']['reward'] as $v) {
                if ($names === 1 || in_array($v['name'], $names)) {
                    $this->essence_map_get_mopup_price($id, $diff_id, $monster_id, $times);
                    return 1;
                } else {
                    // echo '没有'.(implode(',',$names)).';跳过</br>';//没必要显示...
                }
            }
        } else {
            echo '精英地图攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扫荡精英之前获取次数
    private function essence_map_get_mopup_price($id, $diff_id, $monster_id, $times)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'get_mopup_price';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '剩余' . $res['vip_times'] . '次,扫' . $times . '次</br>';
            $res['vip_times'] = min($res['vip_times'], $times);
            $ten = floor($res['vip_times'] / 10);
            if ($ten > 0) {
                for ($i = $ten; $i > 0; $i--) {
                    if ($this->essence_map_mop_up($id, $diff_id, $monster_id, 10)) {
                        $res['vip_times'] -= 10;
                    }
                }
            }
            $five = floor($res['vip_times'] / 5);
            if ($five > 0) {
                for ($i = $five; $i > 0; $i--) {
                    if ($this->essence_map_mop_up($id, $diff_id, $monster_id, 5)) {
                        $res['vip_times'] -= 5;
                    }
                }
            }
            if ($res['vip_times'] > 0) {
                for ($i = $res['vip_times']; $i > 0; $i--) {
                    $this->essence_map_mop_up($id, $diff_id, $monster_id, 1);
                }
            }
            return 1;
        } else {
            echo '扫荡精英之前获取次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扫荡精英
    private function essence_map_mop_up($id, $diff_id, $monster_id, $times)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'mop_up';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['monster_id'] = $monster_id;
        $arr['times'] = $times;

        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '扫荡成功</br>';
            return 1;
        } else {
            echo '精英地图扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取每日活动列表
    private function activity_index()
    {
        $c['c'] = 'activity';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['box_info'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->activity_get_active_value_box($v['id']);
                }
            }
            return;
        } else {
            echo '每日活动列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //领取每日活动宝箱
    private function activity_get_active_value_box($box_id)
    {
        $c['c'] = 'activity';
        $c['m'] = 'get_active_value_box';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['box_id'] = $box_id;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '每日活动宝箱' . $box_id . '领取成功</br>';
            return;
        } else {
            echo '每日活动宝箱领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取八卦阵列表,matrix阵法数组
    private function eight_diagram_index($lv = 3, $matrix)
    {
        $c['c'] = 'eight_diagram';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['now_level'] == 0) {
                //进入八卦
                $this->eight_diagram_level_index($lv, $matrix);
            } else {
                $this->eight_diagram_level_index($res['now_level'], $matrix);
            }
            return;
        } else {
            echo '八卦阵列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //重置八卦阵
    private function eight_diagram_reset_point($lv, $matrix)
    {
        $c['c'] = 'eight_diagram';
        $c['m'] = 'reset_point';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '重置八卦阵成功</br>';
            $this->eight_diagram_level_index($lv, $matrix);
            return;
        } else {
            echo '重置八卦阵失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //进入八卦阵
    private function eight_diagram_level_index($level, $matrix)
    {
        $c['c'] = 'eight_diagram';
        $c['m'] = 'level_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['level'] = $level;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            foreach ($res['list'] as $k => $v) {
                if ($matrix[$k + 2] != $matrix[$k + 1] && $v['button'] != 2) {
                    $use = explode(',', $matrix[$k + 2]);
                    $ret = $this->matrix_use_case($use[0], $use[1]);
                    if ($ret === 0) {
                        return;
                    }
                }
                if ($v['button'] != 2) {
                    $ret2 = $this->eight_diagram_pk($level, $matrix);
                    if ($ret2 != 1) {
                        return;
                    }
                }
            }
            //重置
            $this->eight_diagram_reset_point($matrix[1], $matrix);
            return;
        } else {
            echo '进入八卦阵失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八卦阵战斗
    private function eight_diagram_pk($level, $matrix, $i = 0)
    {
        $c['c'] = 'eight_diagram';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['level'] = $level;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '八卦阵攻击成功...</br>';
                //$this->eight_diagram_pk($level);
            } else {
                $i++;
                if ($i >= 10) {
                    echo '八卦阵打了' . $i . '次还没打过,请手动布阵</br>';
                    return 0;
                }
                echo '八卦阵没打过,重试第' . $i . '次</br>';
                $this->eight_diagram_pk($level, $matrix, $i);
            }
            return 1;
        } elseif ($res['status'] == -10) {
            echo '八卦阵已通关,尝试重置</br>';
            $this->eight_diagram_reset_point($matrix[1], $matrix);
            return 1;
        } else {
            echo '八卦阵战斗失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //切换阵法
    private function matrix_use_case($mid, $case)
    {
        $c['c'] = 'matrix';
        $c['m'] = 'use_case';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mid'] = $mid;
        $arr['case'] = $case;
        echo '等待切换阵法</br>';
        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '切换' . $mid . '阵法 方案' . $case . '成功</br>';
            return 1;
        } else {
            if ($res['status'] == -2) {
                echo '当前就是' . $mid . '阵法 方案' . $case . ',无需切换</br>';
                return 1;
            }
            echo '切换' . $mid . '阵法 方案' . $case . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取当前的阵法
    private function matrix_case_index()
    {
        $c['c'] = 'matrix';
        $c['m'] = 'case_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['case'] = $this->member_info['matrixcase'];
        echo '查看当前阵法</br>';
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['case']['mid']) {
                return [$res['case']['mid'], $this->member_info['matrixcase']];
            } else {
                return 0;
            }
        } else {
            echo '查看当前阵法失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //端午节粽子领奖
    public function quyuan_festival_take_poll()
    {
        $c['c'] = 'quyuan_festival';
        $c['m'] = 'take_poll';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '端午节投投票奖励已领取</br>';
            return;
        } else {
            echo '端午节投投票奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //折扣狂欢-摇钱树
    private function discount_carnival_cash_cow_index()
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'cash_cow_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['shake_num'] > 0) {
                $ret = $this->discount_carnival_shake($res['shake_num']);
                // sleep(1);
                if ($ret == 1) {
                    //重新请求数据
                    $this->discount_carnival_cash_cow_index();
                    return;
                }
            }
            foreach ($res['cashcow_achieve'] as $v) {
                if ($v['is_take'] == 1) {
                    //领取累计次数奖励
                    $this->discount_carnival_shake_achieve($v['id']);
                    // sleep(1);
                }
            }
            return;
        } else {
            echo '折扣狂欢-摇钱树读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //折扣狂欢-摇钱树-一键摇树
    private function discount_carnival_shake($num)
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'shake';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['num'] = $num;

        $res = $this->post($url, $arr);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            echo '折扣狂欢-摇钱树-一键摇树成功,剩余元宝:' . $res['gold'] . '</br>';
            return 1;
        } else {
            echo '折扣狂欢-摇钱树-一键摇树失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //折扣狂欢-摇钱树-领取次数奖励
    public function discount_carnival_shake_achieve($id)
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'shake_achieve';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '折扣狂欢-摇钱树-次数奖励已领取</br>';
            return;
        } else {
            echo '折扣狂欢-摇钱树-次数奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //折扣狂欢-每日签到
    public function discount_carnival_sign_index()
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            //不管签没签到,再签一次
            $this->discount_carnival_sign();
            foreach ($res['task_info'] as $v) {
                if ($v['task_take_status'] == 1) {
                    $this->discount_carnival_take_task_reward($v['id']);
                }
            }
            return;
        } else {
            echo '折扣狂欢-每日签到打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //折扣狂欢-每日签到-签到动作
    public function discount_carnival_sign()
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '折扣狂欢-每日签到-签到奖励已领取</br>';
            return;
        } else {
            echo '折扣狂欢-每日签到-签到奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //折扣狂欢-每日签到-每日任务领取
    public function discount_carnival_take_task_reward($id)
    {
        $c['c'] = 'discount_carnival';
        $c['m'] = 'take_task_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '折扣狂欢-每日签到-每日任务奖励已领取</br>';
            return;
        } else {
            echo '折扣狂欢-每日签到-每日任务奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //50级专用,把所有道具兑换成古玉(含元宝)
    private function actguyu_all()
    {
        $c['c'] = 'actguyu';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            foreach ($res['list_guyu'] as $v) {
                if ($v['remain_num'] > 0) {
                    $res2 = $this->actguyu($v['id'], $v['remain_num']);
                    // sleep(1);
                }
                if ($v['coin_type1'] == 7 && $v['coin_type2'] == 1) { //需要声望+元宝兑换
                    $gold[] = $v;
                }
            }
            $resources = $res2 ? $res2 : $res;
            //将元宝道具倒序,因为越后面的性价比越高
            $gold = array_reverse($gold);
            $res3 = false;
            foreach ($gold as $v2) {
                $resources = $res3 ? $res3 : $resources;
                $max1 = floor($resources['reputation'] / $v2['coin_num1']); //计算声望可以换多少个,去1取整
                $max2 = floor($resources['gold'] / $v2['coin_num2']); //计算元宝可以换多少个,去1取整
                $num = min($max1, $max2); //取出两个最小值
                if ($num > 0) {
                    $res3 = $this->actguyu($v2['id'], $num);
                    // sleep(1);
                }
            }

            $resources = $res3 ? $res3 : $resources;
            //再把所有古玉兑换成银币
            $res4 = $this->actguyu(34, $resources['guyu']);
            echo '古玉跑完</br>';
            return 1;
        } else {
            echo '古玉数据获取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
        //echo die;
    }
    //兑换古玉
    private function actguyu($id, $num)
    {
        $c['c'] = 'actguyu';
        $c['m'] = 'reward_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['num'] = $num;
        $res = $this->post($url, $arr);

        if ($res['status'] != 1) {
            if ($id == 34) {
                echo '古玉兑换银币失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            } else {
                echo '第' . $id . '个古玉兑换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            }
            return 0;
        }
        echo '兑换成功,当前元宝:' . $res['gold'] . ' 银币:' . $res['silver'] . ' 古玉:' . $res['guyu'] . '</br>';
        return $res;
        //echo die;
    }

    //招财聚宝
    private function actjubao_index($again = false)
    {
        $c['c'] = 'actjubao';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['is_free'] == 1) {
                $this->actjubao_action();
            }
            if ($again) {
                echo '招财聚宝-查看累计奖励</br>';
                foreach ($res['list'] as $v) {
                    if ($v['status'] == 1) {
                        $this->actjubao_get_reward($v['id']);
                    }
                }
            } else {
                $this->actjubao_index(true);
            }
            return;
        } else {
            echo '招财聚宝打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //招财聚宝-转动
    private function actjubao_action()
    {
        $c['c'] = 'actjubao';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = 1;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '招财聚宝-转动成功,剩余元宝:' . $res['all_gold'] . '</br>';
            return;
        } else {
            echo '招财聚宝转动失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //招财聚宝-领取
    private function actjubao_get_reward($id)
    {
        $c['c'] = 'actjubao';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '招财聚宝-领取奖励' . $id . '成功</br>';
            return;
        } else {
            echo '招财聚宝-领取奖励' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //夏日绘卷-属地巡护 首页
    private function four_seasons_picture_patrol_index()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $num = $res['user_info']['free_time'] + $res['user_info']['vip_buy_all_time'] - $res['user_info']['buy_time_log'];
            if (($res['user_info']['vip_buy_all_time'] - $res['user_info']['buy_time_log']) > 0) {
                //购买次数
                $this->four_seasons_picture_patrol_buy_time();
            }
            if ($res['question_info']) {
                $question[1] = 'd';
                $question[2] = 'c';
                $question[3] = 'b';
                $question[4] = 'a';
                $question[5] = 'b';
                $question[6] = 'c';
                $question[7] = 'c';
                $question[8] = 'd';
                $question[9] = 'd';
                $question[10] = 'd';
                $question[11] = 'a';
                $question[12] = 'a';
                $question[13] = 'a';
                $question[14] = 'b';
                $question[15] = 'c';
                $question[16] = 'b';
                $question[17] = 'c';
                $question[18] = 'd';
                $question[19] = 'b';
                $question[20] = 'b';
                $question[21] = 'c';
                $question[22] = 'a';
                $question[23] = 'd';
                $question[24] = 'd';
                $question[25] = 'a';
                $question[26] = 'd';
                $question[27] = 'a';
                $question[28] = 'c';
                $question[29] = 'd';
                $question[30] = 'd';
                $question[31] = 'd';
                $question[32] = 'd';
                $question[33] = 'd';
                $question[34] = 'c';
                $question[35] = 'a';
                $question[36] = 'b';
                $question[37] = 'c';
                $question[38] = 'd';
                $question[39] = 'd';
                $question[40] = 'c';
                $question[41] = 'd';
                $question[42] = 'b';
                $question[43] = 'b';
                $question[44] = 'a';
                $question[45] = 'b';
                $question[46] = 'd';
                $question[47] = 'c';
                $question[48] = 'a';
                $question[49] = 'a';
                $question[50] = 'b';
                $question[51] = 'b';
                $question[52] = 'c';
                $question[53] = 'c';
                $question[54] = 'b';
                $question[55] = 'a';
                $question[56] = 'c';
                $question[57] = 'b';
                $question[58] = 'd';
                $question[59] = 'b';
                $question[60] = 'b';
                $question[61] = 'd';
                $question[62] = 'a';
                $question[63] = 'a';
                $question[64] = 'd';
                $question[65] = 'b';
                $question[66] = 'a';
                $question[67] = 'b';
                $question[68] = 'c';
                $question[69] = 'c';
                $question[70] = 'a';
                if (!$question[$res['question_info']['id']]) {
                    echo '这题题库没有,请截图给开发者加入题库;id:' . $res['question_info']['id'] . ',问题:' . $res['question_info']['question'] . ',答案:' . $res['question_info']['A'] . ' ' . $res['question_info']['B'] . ' ' . $res['question_info']['C'] . ' ' . $res['question_info']['D'] . ' </br>';
                } else {
                    echo '问题:' . $res['question_info']['question'] . ',答案:' . strtoupper($question[$res['question_info']['id']]) . ' ' . $res['question_info'][strtoupper($question[$res['question_info']['id']])] . '</br>';
                }
                $this->four_seasons_picture_patrol_answer($question, $res['question_info']['id'], $question[$res['question_info']['id']]);
                return;
            }
            if ($num > 0) {
                //开始答题
                $this->four_seasons_picture_patrol_start();
            }

            foreach ($res['user_picture_info'] as $v) {
                if ($v['chip_1_num'] > 0 && $v['chip_2_num'] > 0 && $v['chip_3_num'] > 0 && $v['chip_4_num'] > 0) {
                    $this->four_seasons_picture_patrol_compose_picture($v['picture_id']);
                }
            }

            if ($res['user_patrol_all_progress'] == 50) {
                $this->four_seasons_picture_patrol_progress_reward();
            }

            return;
        } else {
            echo '夏日绘卷-属地巡护打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-属地巡护-购买次数
    private function four_seasons_picture_patrol_buy_time()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_buy_time';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-属地巡护-购买次数</br>';
            $this->four_seasons_picture_patrol_buy_time();
            return;
        } else {
            echo '夏日绘卷-属地巡护-购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-属地巡护-巡护进度领取
    private function four_seasons_picture_patrol_progress_reward()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_progress_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-属地巡护-巡护进度领取</br>';
            return;
        } else {
            echo '夏日绘卷-属地巡护-巡护进度领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-属地巡护-武将拼图-一件领取
    private function four_seasons_picture_patrol_compose_picture($picture)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_compose_picture';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['picture'] = $picture;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-属地巡护-武将拼图-一件领取' . $picture . '</br>';
            return;
        } else {
            echo '夏日绘卷-属地巡护-武将拼图-一件领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-属地巡护-开始巡护
    private function four_seasons_picture_patrol_start()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;


        //问题的答案,重复打开文件太浪费资源了,所以写在代码中
        $question[1] = 'd';
        $question[2] = 'c';
        $question[3] = 'b';
        $question[4] = 'a';
        $question[5] = 'b';
        $question[6] = 'c';
        $question[7] = 'c';
        $question[8] = 'd';
        $question[9] = 'd';
        $question[10] = 'd';
        $question[11] = 'a';
        $question[12] = 'a';
        $question[13] = 'a';
        $question[14] = 'b';
        $question[15] = 'c';
        $question[16] = 'b';
        $question[17] = 'c';
        $question[18] = 'd';
        $question[19] = 'b';
        $question[20] = 'b';
        $question[21] = 'c';
        $question[22] = 'a';
        $question[23] = 'd';
        $question[24] = 'd';
        $question[25] = 'a';
        $question[26] = 'd';
        $question[27] = 'a';
        $question[28] = 'c';
        $question[29] = 'd';
        $question[30] = 'd';
        $question[31] = 'd';
        $question[32] = 'd';
        $question[33] = 'd';
        $question[34] = 'c';
        $question[35] = 'a';
        $question[36] = 'b';
        $question[37] = 'c';
        $question[38] = 'd';
        $question[39] = 'd';
        $question[40] = 'c';
        $question[41] = 'd';
        $question[42] = 'b';
        $question[43] = 'b';
        $question[44] = 'a';
        $question[45] = 'b';
        $question[46] = 'd';
        $question[47] = 'c';
        $question[48] = 'a';
        $question[49] = 'a';
        $question[50] = 'b';
        $question[51] = 'b';
        $question[52] = 'c';
        $question[53] = 'c';
        $question[54] = 'b';
        $question[55] = 'a';
        $question[56] = 'c';
        $question[57] = 'b';
        $question[58] = 'd';
        $question[59] = 'b';
        $question[60] = 'b';
        $question[61] = 'd';
        $question[62] = 'a';
        $question[63] = 'a';
        $question[64] = 'd';
        $question[65] = 'b';
        $question[66] = 'a';
        $question[67] = 'b';
        $question[68] = 'c';
        $question[69] = 'c';
        $question[70] = 'a';

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['question_info']) {
                // var_dump($question[$res['question_info']['id']]);
                if (!$question[$res['question_info']['id']]) {
                    echo '这题题库没有,请截图给开发者加入题库;id:' . $res['question_info']['id'] . ',问题:' . $res['question_info']['question'] . ',答案:' . $res['question_info']['A'] . ' ' . $res['question_info']['B'] . ' ' . $res['question_info']['C'] . ' ' . $res['question_info']['D'] . ' </br>';
                } else {
                    echo '问题:' . $res['question_info']['question'] . ',答案:' . strtoupper($question[$res['question_info']['id']]) . ' ' . $res['question_info'][strtoupper($question[$res['question_info']['id']])] . '</br>';
                }
                $this->four_seasons_picture_patrol_answer($question, $res['question_info']['id'], $question[$res['question_info']['id']]);
            } else {
                echo '遇到npc,跳过答题直接给碎片</br>';
                //遇到npc重新开始
                $this->four_seasons_picture_patrol_start();
            }
            return;
        } else {
            echo '夏日绘卷-属地巡护-开始巡护失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-属地巡护-开始巡护-答题
    private function four_seasons_picture_patrol_answer($question_arr, $quertion, $answer)
    {
        // var_dump($question_arr,$quertion,$answer);die;
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'patrol_answer';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['quertion'] = $quertion;
        $c['answer'] = $answer;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['question_info']) {
                if (!$question_arr[$res['question_info']['id']]) {
                    echo '这题题库没有,请截图给开发者加入题库;id:' . $res['question_info']['id'] . ',问题:' . $res['question_info']['question'] . ',答案:' . $res['question_info']['A'] . ' ' . $res['question_info']['B'] . ' ' . $res['question_info']['C'] . ' ' . $res['question_info']['D'] . ' </br>';
                } else {
                    echo '问题:' . $res['question_info']['question'] . ',答案:' . strtoupper($question_arr[$res['question_info']['id']]) . ' ' . $res['question_info'][strtoupper($question_arr[$res['question_info']['id']])] . '</br>';
                }
                //继续答题
                $this->four_seasons_picture_patrol_answer($question_arr, $res['question_info']['id'], $question_arr[$res['question_info']['id']]);
            } else {
                //答完重新开始
                $this->four_seasons_picture_patrol_start();
            }
            return;
        } else {
            // var_dump($res);
            echo '夏日绘卷-属地巡护-开始巡护-答题失败:' . $res['msg'] . '状态码' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-凌云阁
    private function four_seasons_picture_cloud_floor_index()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'cloud_floor_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-凌云阁打开</br>';
            foreach ($res['cloud_floor_list'] as $v) {
                if ($v['own'] == 1) {
                    $this->four_seasons_picture_cloud_floor_build_info($v['build_year']);
                    break;
                }
            }
            return;
        } else {
            echo '夏日绘卷-凌云阁打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-凌云阁-盖楼
    private function four_seasons_picture_cloud_floor_build_info($build_year)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'cloud_floor_build_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['build_year'] = $build_year;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-凌云阁-盖楼打开</br>';
            if ($res['remain_times'] > 0) {
                $this->four_seasons_picture_cloud_floor_build_start();
            } else {
                echo '夏日绘卷-凌云阁-盖楼次数不足</br>';
            }
            return;
        } else {
            echo '夏日绘卷-凌云阁-盖楼打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-凌云阁-盖楼-建造
    private function four_seasons_picture_cloud_floor_build_start()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'cloud_floor_build_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-凌云阁-盖楼-建造一次,获得元宝:' . $res['get_reward']['reward_value'] . '</br>';
            $this->four_seasons_picture_cloud_floor_build_start();
            return;
        } else {
            echo '夏日绘卷-凌云阁-盖楼-建造失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-凌云阁-盖楼-评价奖励
    private function four_seasons_picture_cloud_floor_achievement_reward_info()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'cloud_floor_achievement_reward_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开夏日绘卷-凌云阁-盖楼-评价奖励</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['reward_list'] as $v) {
                if ($v['get_status'] == 1) {
                    $ret = $this->four_seasons_picture_receive_cloud_floor_achievement_reward($v['id']);
                }
            }
            if (!$ret) {
                echo '夏日绘卷-凌云阁-暂无可领评价奖励</br>';
            }
            return;
        } else {
            echo '夏日绘卷-凌云阁-盖楼-评价奖励打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日绘卷-凌云阁-盖楼-评价奖励-领取
    private function four_seasons_picture_receive_cloud_floor_achievement_reward($id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'receive_cloud_floor_achievement_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '夏日绘卷-凌云阁-评价奖励' . $id . '领取成功</br>';
            return 1;
        } else {
            echo '夏日绘卷-凌云阁-评价奖励' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季首页
    private function four_seasons_picture_fruits_index()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            //先购买 
            $buy_num = $this->four_seasons_picture_fruits_buytime_index();
            if ($res['user_info']['free_time'] + $res['user_info']['buy_time'] + $buy_num > 0) {
                //有次数就采集
                for ($i = 0; $i < $res['user_info']['free_time'] + $res['user_info']['buy_time'] + $buy_num; $i++) {
                    $this->four_seasons_picture_fruits_pluck();
                }
            } else {
                echo '秋日绘卷-丰收季采集次数不足</br>';
            }
            //然后运输
            $this->four_seasons_picture_fruits_sale_index();
            //最后收获
            $this->four_seasons_picture_transport_info();
            return 1;
        } else {
            echo '秋日绘卷-丰收季首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-采集
    private function four_seasons_picture_fruits_pluck()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_pluck';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-丰收季-采集成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-丰收季-采集失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-购买次数列表
    private function four_seasons_picture_fruits_buytime_index()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_buytime_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $i = 0;
            foreach ($res['fruits_buy_time_info'] as $v) {
                if ($v['buytime_log'] == 0) {
                    $ret = $this->four_seasons_picture_fruits_buytime($v['id']);
                    $i += $ret;
                }
            }
            return $i;
        } else {
            echo '秋日绘卷-丰收季-采集失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-购买次数动作
    private function four_seasons_picture_fruits_buytime($id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_buytime';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-丰收季-购买次数成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-丰收季-购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-出售水果首页
    private function four_seasons_picture_fruits_sale_index()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_sale_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        echo '秋日绘卷-丰收季-出售水果计算</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $list = [];
            // $i = 0;
            foreach ($res['fruits_list'] as $goods_info) {
                foreach ($res['fruits_sale_rule'] as $sale_list) {
                    foreach ($sale_list as $sale_info) {
                        if ($goods_info['good_id'] == $sale_info['good_id'] && $goods_info['live_end'] > $sale_info['track_time']) {
                            $profit = $goods_info['goods_num'] * $sale_info['sale_price'] - $sale_info['track_gold'];
                            $profit2 = $list[$goods_info['id']] ? 0 : $goods_info['goods_num'] * $list[$goods_info['id']]['sale_price'] - $list[$goods_info['id']]['track_gold'];
                            if ($profit <= $profit2) {
                                // echo ++$i;
                                continue;
                            } else {
                                $list[$goods_info['id']] = $sale_info;
                            }
                        }
                    }
                }
            }
            // var_dump($list);die;
            foreach ($list as $k => $v) {
                if ($_POST['four_seasons_picture_fruits_index'][1] == 1) {
                    $this->four_seasons_picture_fruits_sale(1, $k);
                } else {
                    $this->four_seasons_picture_fruits_sale($v['shop_id'], $k);
                }
            }
            return 1;
        } else {
            echo '秋日绘卷-丰收季-出售水果首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-出售水果-运输动作
    private function four_seasons_picture_fruits_sale($shop_id, $id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_sale';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['shop_id'] = $shop_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-丰收季-运输水果成功</br>';
            return 1;
        } else {
            var_dump($shop_id, $id);
            echo '秋日绘卷-丰收季-运输水果失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-出售水果-运输详情列表
    private function four_seasons_picture_transport_info()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'transport_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        echo '打开秋日绘卷-丰收季-出售水果-运输详情列表</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['user_fruits'] as $v) {
                if ($v['is_sale'] == 1) {
                    $this->four_seasons_picture_fruits_sale_reward($v['id']);
                }
            }
            return 1;
        } else {
            echo '秋日绘卷-丰收季-出售水果-运输详情列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-丰收季-出售水果-运输详情-领取奖励
    private function four_seasons_picture_fruits_sale_reward($id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fruits_sale_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-丰收季-出售水果-运输详情-领取奖励成功,获得元宝:' . $res['add_gold'] . '</br>';
            return 1;
        } else {
            echo '秋日绘卷-丰收季-出售水果-运输详情-领取奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //秋日绘卷-夺红叶首页 参1队伍id 参2选择道具id
    private function four_seasons_picture_grab_red_leaves_index($team, $arms_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $user_team[0] = '无队伍';
            $user_team[1] = '红方';
            $user_team[2] = '蓝方';
            echo '打开秋日绘卷-夺红叶,当前角色队伍情况:' . $user_team[$res['user_team']] . '</br>';
            if ($res['user_team'] != $team) {
                return 0;
            }
            if ($res['leavers_arms']) {
                if ($res['attack_defend'] == 2) {
                    $arms_id += 3;
                }
                $this->four_seasons_picture_grab_red_leaves_arms_vote($arms_id);
            } else {
                echo '秋日绘卷-夺红叶-当前不在投票阶段</br>';
            }
            if ($res['leavers_buff_info']) {
                if (!$res['leavers_buff_info']['buff_open']) {
                    $this->four_seasons_picture_grab_red_leaves_open_buff();
                }
            } else {
                echo '秋日绘卷-夺红叶-当前不在buff阶段</br>';
            }
            return 1;
        } else {
            echo '秋日绘卷-夺红叶首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-夺红叶-报名
    private function four_seasons_picture_grab_red_leaves_entry()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_entry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-夺红叶-报名成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-夺红叶-报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-夺红叶-捐buff
    private function four_seasons_picture_grab_red_leaves_open_buff()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_open_buff';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-夺红叶-捐buff成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-夺红叶-捐buff失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-夺红叶-投票
    private function four_seasons_picture_grab_red_leaves_arms_vote($arms_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_arms_vote';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['arms_id'] = $arms_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-夺红叶-投票成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-夺红叶-投票失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-夺红叶-领取回合奖励
    private function four_seasons_picture_grab_red_leaves_take_reward()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_take_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-夺红叶-领取回合奖励成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-夺红叶-领取回合奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-夺红叶-领取最终奖励
    private function four_seasons_picture_grab_red_leaves_take_final_reward()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'grab_red_leaves_take_final_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-夺红叶-领取最终奖励成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-夺红叶-领取最终奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //秋日绘卷-河蟹肥首页
    private function four_seasons_picture_crab_index($b = false)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['collect_feed_down_time'] == 0) {
                if ($res['collect_feed_status'] == 2) {
                    echo '秋日绘卷-河蟹肥-可以收饲料</br>';
                    $this->four_seasons_picture_crab_take_feed();
                    $this->four_seasons_picture_crab_index();
                    return;
                } elseif ($res['collect_feed_status'] == 0) {
                    echo '秋日绘卷-河蟹肥-可以买饲料</br>';
                    $this->four_seasons_picture_crab_collect_feed();
                }
            } else {
                echo '秋日绘卷-河蟹肥-饲料还有' . $res['collect_feed_down_time'] . '秒可收获</br>';
            }
            //判断是否收螃蟹
            if ($res['user_feed_farm']['feed_end_time'] > 0 && $res['user_feed_farm']['feed_end_time'] < time()) {
                $this->four_seasons_picture_crab_take_back_myselp();
                $this->four_seasons_picture_crab_index();
                return;
            }
            //根据第一只非100的螃蟹去选择用什么饲料,100 - 当前 再挨个加上 10 25 40 60,看看哪个最接近100就用哪个
            $wei = 0;
            foreach ($res['user_crab'] as $v) {
                if ($v['crab_ovary'] >= 100) {
                    //卖出
                    $this->four_seasons_picture_crab_sale($v['id']);
                } else {
                    if ($v['own_or_other']  == 1) {
                        $wei = 1;
                        continue;
                    }
                    if ($v['own_or_other']  == 2) {
                        //尝试收螃蟹
                        $ret = $this->four_seasons_picture_crab_take_back_other($v['feed_farm_uid'], 1);
                        if (!$ret) {
                            $ret = $this->four_seasons_picture_crab_take_back_other($v['feed_farm_uid'], 2);
                        }
                        if (!$ret) {
                            continue;
                        } else {
                            $this->four_seasons_picture_crab_index();
                            return;
                        }
                    }
                    //如果第一只已经喂养,那下面的是蹭
                    if ($wei) {
                        if ($_POST['four_seasons_picture_ceng']) {
                            if ($res['crab_free_refresh'] > 0 && !$b) {
                                $this->four_seasons_picture_crab_refresh_other_feed_farm();
                                $b = true;
                                $this->four_seasons_picture_crab_index($b);
                            }
                            foreach ($res['other_feed_farm'] as $k => $user) {
                                $ret = $this->four_seasons_picture_crab_other_feed($user['uid'], $v['id'], 1);
                                if ($ret === 0) {
                                    $ret = $this->four_seasons_picture_crab_other_feed($user['uid'], $v['id'], 2);
                                    if ($ret === 0) {
                                        unset($res['other_feed_farm'][$k]);
                                    }
                                }
                                if ($ret === 1) {
                                    continue 2;
                                }
                            }
                        }
                        continue;
                    }
                    $crab_feed = [];
                    foreach ($res['crab_feed'] as $vv) {
                        if ($vv['user_num'] > 0) {
                            $num = $v['crab_ovary'] + $vv['addition'];
                            $crab_feed[$vv['id']] = abs($num - 100);
                        }
                    }
                    if ($crab_feed) {
                        $this->four_seasons_picture_crab_go_feed($v['id'], array_keys($crab_feed, min($crab_feed))[0]);
                    } else {
                        echo '秋日绘卷-河蟹肥-当前没有饲料</br>';
                    }
                    $wei = 1;
                }
            }
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥-刷新可蹭列表
    private function four_seasons_picture_crab_refresh_other_feed_farm()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_refresh_other_feed_farm';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥-刷新可蹭列表成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥-刷新可蹭列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥-收螃蟹
    private function four_seasons_picture_crab_take_back_myselp()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_take_back_myselp';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥-收螃蟹成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥-收螃蟹失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥-收在其他人那的螃蟹
    private function four_seasons_picture_crab_take_back_other($look_uid, $site)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_take_back_other';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['look_uid'] = $look_uid;
        $c['site'] = $site;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥-收在其他人那的螃蟹成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥-收在其他人那的螃蟹失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥-卖螃蟹
    private function four_seasons_picture_crab_sale($crab_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_sale';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['crab_id'] = $crab_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥-卖螃蟹' . $crab_id . '成功,获得元宝:' . $res['add_gold'] . '</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥-卖螃蟹' . $crab_id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥买饲料
    private function four_seasons_picture_crab_collect_feed()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_collect_feed';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥买饲料成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥买饲料失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥收饲料
    private function four_seasons_picture_crab_take_feed()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_take_feed';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥收饲料成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥收饲料失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥喂食 crab_id螃蟹id  feed_id饲料id
    private function four_seasons_picture_crab_go_feed($crab_id, $feed_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_go_feed';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['crab_id'] = $crab_id;
        $c['feed_id'] = $feed_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥喂食成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥喂食失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //秋日绘卷-河蟹肥-蹭食 look_uid被蹭人id  crab_id螃蟹id site几号位12
    private function four_seasons_picture_crab_other_feed($look_uid, $crab_id, $site)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'crab_other_feed';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['look_uid'] = $look_uid;
        $c['crab_id'] = $crab_id;
        $c['site'] = $site;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '秋日绘卷-河蟹肥-蹭食成功</br>';
            return 1;
        } else {
            echo '秋日绘卷-河蟹肥-蹭食失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //冬日绘卷-冰糖葫芦
    private function four_seasons_picture_sugar_calabash()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'sugar_calabash';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开冬日绘卷-冰糖葫芦</br>';
            if ($res['robot'] > 0) {
                $this->four_seasons_picture_lottery();
            } else {
                echo '冬日绘卷-冰糖葫芦-开注次数不足</br>';
            }
            return 1;
        } else {
            echo '冬日绘卷-冰糖葫芦打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-冰糖葫芦-开注
    private function four_seasons_picture_lottery($stake = 1, $odevity = 1)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['stake'] = $stake;
        $arr['odevity'] = $odevity;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '冬日绘卷-冰糖葫芦-开注...</br>';
            if ($res['round'] % 2 != 0) {
                $this->four_seasons_picture_lottery(1, 1);
            } else {
                $this->four_seasons_picture_lottery(1, null);
            }
            return 1;
        } else {
            echo '冬日绘卷-冰糖葫芦-开注失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗
    private function four_seasons_picture_snowball_fight()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'snowball_fight';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开冬日绘卷-打雪仗</br>';
            if ($res['current_mission'] < 6) {
                if ($res['equip_shop'][4]['own'] == 0 && $res['equip_shop'][4]['price'] <= $res['snowflake']) {
                    $this->four_seasons_picture_exchange($res['equip_shop'][4]['id']);
                    foreach ($res['equip_list'] as $v) {
                        if ($v['status'] == 1) {
                            $this->four_seasons_picture_remove($v['id']);
                        }
                    }
                    $this->four_seasons_picture_equip($res['equip_shop'][4]['id']);
                }
            } else {
                if ($res['equip_shop'][3]['own'] == 0) {
                    if ($res['equip_shop'][3]['price'] <= $res['snowflake']) {
                        $this->four_seasons_picture_exchange($res['equip_shop'][3]['id']);
                        foreach ($res['equip_list'] as $v) {
                            if ($v['status'] == 1) {
                                $this->four_seasons_picture_remove($v['id']);
                            }
                        }
                        $this->four_seasons_picture_equip($res['equip_shop'][3]['id']);
                        $res['user_info']['attack'] += 50;
                    } else {
                        echo '雪花不够,请自行凑够 攻击弹弓-大 的雪花(30个)</br>';
                        return;
                    }
                }
                //我方速度需要比对方快
                $speed = $res['monster_info']['speed'] + 1 - $res['user_info']['speed'];
                if ($speed <= 0) {
                    $speed = 0;
                }
                //对方生命+护甲需要 = 我方攻击力
                $attack = $res['monster_info']['blood'] + $res['monster_info']['armor'] - $res['user_info']['attack'];
                if ($attack < 0 && $res['monster_info']['blood'] + $res['monster_info']['armor'] >= 60) {
                    $this->four_seasons_picture_reset();
                    $this->four_seasons_picture_snowball_fight();
                    return;
                }
                if ($speed > 0 || $attack > 0) {
                    $this->four_seasons_picture_distribute($attack + $res['distribute_points']['attack'], $res['distribute_points']['blood'], $speed + $res['distribute_points']['speed']);
                }
            }
            if ($res['today_time'] < 4) {
                $next = $res['next_monster_info']['id'] ? $res['next_monster_info']['id'] : $res['current_mission'];
                $this->four_seasons_picture_fight($next);
                return 1;
            }
            foreach ($res['reward_list'] as $vv) {
                if ($vv['status'] == 2) {
                    $this->four_seasons_picture_draw($vv['id']);
                }
            }
            return 1;
        } else {
            echo '冬日绘卷-打雪仗打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-成就
    private function four_seasons_picture_draw($reward_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'draw';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['reward_id'] = $reward_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-成就领取成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-成就领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-兑换
    private function four_seasons_picture_exchange($equip_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'exchange';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['equip_id'] = $equip_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-兑换' . $res['equip_info']['name'] . '成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-兑换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-装备
    private function four_seasons_picture_equip($equip_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'equip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['equip_id'] = $equip_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-装备' . $equip_id . '成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-装备' . $equip_id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-加点
    private function four_seasons_picture_distribute($attack, $blood, $speed)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'distribute';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['attack'] = $attack;
        $arr['blood'] = $blood;
        $arr['speed'] = $speed;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-加点成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-加点失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-加点重置
    private function four_seasons_picture_reset()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'reset';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-加点重置成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-加点重置失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-卸下装备
    private function four_seasons_picture_remove($equip_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'remove';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['equip_id'] = $equip_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-打雪仗-卸下装备' . $equip_id . '成功</br>';
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-卸下装备' . $equip_id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-打雪仗-挑战
    private function four_seasons_picture_fight($mission_id)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'fight';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mission_id'] = $mission_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['pass_gold']) {
                echo '冬日绘卷-打雪仗-挑战成功,元宝+' . $res['pass_gold'] . ',可分点数+' . $res['pass_points'] . ',雪花+' . $res['pass_snowflake'] . '</br>';
                $this->four_seasons_picture_snowball_fight();
            } else {
                echo '冬日绘卷-打雪仗-挑战失败....</br>';
            }
            return 1;
        } else {
            echo '冬日绘卷-打雪仗-挑战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-步履薄冰
    private function four_seasons_picture_tread_ice()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'tread_ice';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开冬日绘卷-步履薄冰</br>';
            for ($i = 1; $i <= 3; $i++) {
                $this->four_seasons_picture_start();
            }
            echo '冬日绘卷-步履薄冰-次数不足</br>';
            return 1;
        } else {
            echo '冬日绘卷-步履薄冰打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-步履薄冰-开始
    private function four_seasons_picture_start()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '冬日绘卷-步履薄冰-开始,正确位置:' . $res['route'] . '...等待4秒</br>';
            sleep(4);
            $this->four_seasons_picture_commit($res['route']);
            return 1;
        } else {
            echo '冬日绘卷-步履薄冰-开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-步履薄冰-提交
    private function four_seasons_picture_commit($route)
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'commit';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['route'] = $route;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '冬日绘卷-步履薄冰-提交成功</br>';
            $this->four_seasons_picture_next();
            return 1;
        } else {
            echo '冬日绘卷-步履薄冰-提交失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //冬日绘卷-步履薄冰-下一关
    private function four_seasons_picture_next()
    {
        $c['c'] = 'four_seasons_picture';
        $c['m'] = 'next';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '冬日绘卷-步履薄冰-进入下一关...等待4秒</br>';
            sleep(4);
            $this->four_seasons_picture_commit($res['route']);
            return 1;
        } else {
            echo '冬日绘卷-步履薄冰-进入下一关失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //购物节-超值预购
    private function nineteen_eleven_pre_buy_order($id)
    {
        $c['c'] = 'nineteen_eleven';
        $c['m'] = 'pre_buy_order';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '购物节-超值预购第' . $id . '个成功</br>';
            return 1;
        } else {
            echo '购物节-超值预购第' . $id . '个失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //典当行-我的专柜
    private function pawn_shop_own_counter_index($buy_types)
    {
        $c['c'] = 'pawn_shop';
        $c['m'] = 'own_counter_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '典当行-打开我的专柜</br>';
            $site = 1;
            foreach ($res['reward_list'] as $v) {
                $site = $v['site'];
            }
            if ($site < 12) {
                for ($i = $site; $i <= 12; $i++) {
                    $this->pawn_shop_counter_goods_select($buy_types, $i);
                }
            } else {
                echo '典当行-专柜已满</br>';
            }
            return;
        } else {
            echo '典当行-我的专柜打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //典当行-获取可上架材料
    private function pawn_shop_counter_goods_select($buy_types, $site = 1)
    {
        $c['c'] = 'pawn_shop';
        $c['m'] = 'counter_goods_select';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['site'] = $site;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['goods_list'] as $v) {
                if (in_array($v['cost_type'], $buy_types) && $v['own_num'] > $v['cost_value']) {
                    $num = min(floor($v['own_num'] / $v['cost_value']), $v['limit']);
                    $this->pawn_shop_counter_goods_put_on_sale($site, $v['id'], $num);
                    return;
                }
            }
        } else {
            echo '典当行-获取可上架材料失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //典当行-上架
    private function pawn_shop_counter_goods_put_on_sale($site, $goods_id, $num)
    {
        $c['c'] = 'pawn_shop';
        $c['m'] = 'counter_goods_put_on_sale';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['site'] = $site;
        $arr['goods_id'] = $goods_id;
        $arr['num'] = $num;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '典当行-上架成功</br>';
        } else {
            echo '典当行-上架失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //典当行-好友列表
    private function friend_index($reward_type, $discount = 100, $p = 1)
    {
        $c['c'] = 'friend';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;
        $arr['l'] = 100;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                echo '典当行-尝试进入 ' . $v['nickname'] . ' 的专柜</br>';
                $ret = $this->pawn_shop_get_others_counter($v['fuid'], $reward_type, $discount, 3);
                if ($ret == -1) {
                    return;
                }
            }
            if ($res['all_page'] > $p) {
                $this->friend_index($reward_type, $discount, $p + 1);
            }
            return;
        } else {
            echo '典当行-好友列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //典当行-前往好友专柜
    //type 1国家 2跨服 3好友
    //reward_type 购买的商品种类
    //discount 折扣率
    private function pawn_shop_get_others_counter($to_uid, $reward_type, $discount, $type = 3, $to_serverid = '')
    {
        $c['c'] = 'pawn_shop';
        $c['m'] = 'get_others_counter';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['to_uid'] = $to_uid;
        $arr['type'] = $type;
        if (!$to_serverid) {
            $to_serverid = explode(',', array_values($this->user_arr)[0])[2]; //应该就是当前登录帐号区服id,看了三个已经合区的号是这样
        }
        $arr['to_serverid'] = $to_serverid;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $pawn_ticket = $res['pawn_ticket'];
            $buy = 0;
            // foreach($res['goods_info'] as $v){
            //  if($v['reward_type'] == $reward_type && $v['discount'] <= $discount && $v['remain_num'] > 0){
            //      $max = intval($pawn_ticket/$v['cost_value']);
            //      $num = $max >= $v['remain_num'] ? $v['remain_num'] : $max;
            //      $ret = $this->pawn_shop_others_counter($v['id'],$num,$res['to_uid'],$arr['to_serverid'],$type);
            //      if($ret == 1){
            //          $buy = 1;
            //          $pawn_ticket -= $v['cost_value'] * $num;
            //      }
            //  }
            //  if($pawn_ticket < 100){
            //      echo '典当行-当票不足,剩余:'.$pawn_ticket.'</br>';
            //      return -1;
            //  }
            // }
            foreach ($res['goods_list'] as $v) {
                if (in_array($v['goods_info']['reward_type'], $reward_type) && $v['remain_num'] > 0) {
                    $max = intval($pawn_ticket / $v['goods_info']['cost_value']);
                    $num = $max >= $v['remain_num'] ? $v['remain_num'] : $max;
                    $ret = $this->pawn_shop_others_counter($v['goods_id'], $num, $res['to_uid'], $arr['to_serverid'], $type);
                    if ($ret == 1) {
                        $buy = 1;
                        $pawn_ticket -= $v['goods_info']['cost_value'] * $num;
                    }
                }
                if ($pawn_ticket < 100) {
                    echo '典当行-当票不足,剩余:' . $pawn_ticket . '</br>';
                    return -1;
                }
            }
            if ($buy === 0) {
                echo '该典当行无符合条件的物品</br>';
            }
            return;
        } else {
            // echo '<pre>';var_dump($url,$arr);echo '</pre>';
            echo '典当行-前往它人专柜失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //典当行-专柜购买
    private function pawn_shop_others_counter($id, $num, $to_uid, $to_serverid, $type)
    {
        $c['c'] = 'pawn_shop';
        $c['m'] = 'buy_others_counter';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['num'] = $num;
        $arr['to_uid'] = $to_uid;
        $arr['to_serverid'] = $to_serverid;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '<span style="color:red;">典当行-它人专柜购买成功,缓冲3秒</span></br>';
            sleep(3);
            return 1;
        } else {
            // var_dump($id,$num,$to_uid,$to_serverid,$type);
            echo '典当行-它人专柜购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家商店
    private function country_taxes_shop_index($buy_ids)
    {
        $c['c'] = 'country_taxes_shop';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开国家商店</br>';
            foreach ($res['shop_list']['list'] as $v) {
                if ($v['num'] > 0 && in_array($v['type'], $buy_ids)) {
                    if ($v['limit_type'] == 1) {
                        if ($v['is_take'] == 2) {
                            continue;
                        }
                        $v['num'] = 1;
                    }
                    $this->country_taxes_shop_buy($v['id'], $v['num']);
                }
            }
            return;
        } else {
            echo '国家商店打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家商店-购买
    private function country_taxes_shop_buy($id = 1, $buy_number = 1)
    {
        $c['c'] = 'country_taxes_shop';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['buy_number'] = $buy_number;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '国家商店-购买' . $id . '成功</br>';
            return 1;
        } else {
            echo '国家商店-购买' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取世界发言
    private function chat_read($reward_type, $discount)
    {
        $c['c'] = 'chat';
        $c['m'] = 'read';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['v'] = 0;

        $res = $this->post($url, $arr, [], 1500000);
        if ($res['status'] == 1) {
            if ($res['list']) {
                foreach ($res['list'] as $v) {
                    echo '获取到一条信息:' . $v['nickname'] . ' 说: ' . $v['message'] . '</br>';
                    if ($v['type'] == 80) {
                        echo '典当行-尝试进入 ' . $v['nickname'] . ' 的专柜</br>';
                        $ret = $this->pawn_shop_get_others_counter($v['uid'], $reward_type, $discount, 2, $v['serverid']);
                        if ($ret == -1) {
                            return;
                        }
                    }
                }
            } else {
                echo '无发言,1.5秒后获取下一次发言</br>';
            }
            $this->chat_read($reward_type, $discount);
            return 1;
        } else {
            echo '获取世界发言失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 领取骰子奖励
    private function dice($type = 1)
    {
        $c['c'] = 'dice';
        $c['m'] = 'get_last_week_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '骰子奖励类型 ' . $type . ' 已领取</br>';
            if ($type < 3) {
                $type++;
                $this->dice($type);
            }
            return 1;
        } else {
            echo '骰子奖励类型 ' . $type . '领取失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 国战报名
    private function siege_join_battle()
    {
        $c['c'] = 'siege';
        $c['m'] = 'join_battle';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '国战已报名</br>';
            return 1;
        } else {
            echo '国战报名失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 天赋卷轴列表
    private function talent_get_info($type, $quality = null)
    {
        $c['c'] = 'talent';
        $c['m'] = 'get_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        if ($quality) {
            $arr['quality'] = $quality;
        }

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $this->talent_sweep($res['scroll']['type'], $res['scroll']['quality'], 1);
            if ($res['scroll']['quality'] < $res['max_quality']) {
                $this->talent_get_info($res['scroll']['type'], $res['scroll']['quality'] + 1);
                return 1;
            }
            if ($res['scroll']['type'] < 5) {
                $this->talent_get_info($res['scroll']['type'] + 1);
                return 1;
            }
            return 1;
        } else {
            echo '天赋卷轴扫荡列表读取失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 天赋卷轴扫荡动作
    private function talent_sweep($type, $quality, $check)
    {
        $c['c'] = 'talent';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['quality'] = $quality;
        $arr['check'] = $check;

        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            switch ($res['reel'][0]['quality']) {
                case "1":
                    $name = '白色';
                    break;
                case "2":
                    $name = '绿色';
                    break;
                case "3":
                    $name = '蓝色';
                    break;
                case "4":
                    $name = '金色';
                    break;
                case "5":
                    $name = '紫色';
                    break;
                case "6":
                    $name = '红色';
                    break;
                case "7":
                    $name = '橙色';
                    break;
                case "8":
                    $name = '彩色';
                    break;
                default:
                    $name = $res['reel'][0]['quality'];
                    break;
            }
            echo '天赋卷轴扫荡成功,获得道具:' . $name . $res['reel'][0]['itemname'] . '*' . $res['reel'][0]['num'] . '</br>';
            return 1;
        } else {
            if ($res['status'] == -8) {
                $res['msg'] = '次数不足';
            }
            echo '天赋卷轴扫荡失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }


    // 战鼓扫荡列表
    private function drum_forge_onekey_sweep($materials_id = 50)
    {
        $c['c'] = 'drum_forge';
        $c['m'] = 'onekey_sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['materials_id'] = $materials_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                $this->drum_forge_go_sweep($materials_id, $v['map_level_id'], $v['map_stage_id']);
            }
            return 1;
        } else {
            echo '战鼓精石扫荡列表读取失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓扫荡动作
    private function drum_forge_go_sweep($materials_id, $l, $s, $check = 1)
    {
        $c['c'] = 'drum_forge';
        $c['m'] = 'go_sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['materials_id'] = $materials_id;
        $arr['l'] = $l;
        $arr['s'] = $s;
        $arr['check'] = $check;

        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '战鼓扫荡成功,获得道具:' . $res['info']['itemname'] . '*' . $res['info']['get_number'] . '</br>';
            return 1;
        } else {
            echo '战鼓扫荡失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 丹药扫荡列表
    private function essence_map_go_sweep_medicine()
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'go_sweep_medicine';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['is_open']) {
                    foreach ($v['diff_array_info'] as $vv) {
                        $this->essence_map_sweep($v['id'], $vv['diff_id']);
                    }
                }
            }
            return 1;
        } else {
            echo '丹药扫荡列表读取失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 丹药扫荡动作
    private function essence_map_sweep($id, $diff_id, $check = 1)
    {
        $c['c'] = 'essence_map';
        $c['m'] = 'sweep';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['diff_id'] = $diff_id;
        $arr['check'] = $check;

        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '关卡:' . $id . ',难度:' . $diff_id . '丹药扫荡成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            if ($res['status'] == -15) {
                $res['msg'] = '关卡:' . $id . ',难度:' . $diff_id . '次数不足';
            }
            echo '丹药扫荡失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 采集场
    private function cai_ji_chang()
    {
        $this->workshop_onekey_get_reward();
        $this->exploit_tree_onekey_gather();
        $this->exploit_stone_onekey_gather();
        $this->exploit_tree_onekey_action();
        $this->exploit_stone_onekey_action();
        return;
    }

    // 玉石收集
    private function workshop_onekey_get_reward()
    {
        $c['c'] = 'workshop';
        $c['m'] = 'onekey_get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '玉石收集成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '玉石收集失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 伐木收集
    private function exploit_tree_onekey_gather()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'onekey_gather';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '伐木场收集成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '伐木场收集失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 采石收集
    private function exploit_stone_onekey_gather()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'onekey_gather';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '采石场收集成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '采石场收集失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 伐木采集
    private function exploit_tree_onekey_action()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'onekey_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '伐木场采集成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '伐木场采集失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 采石收集
    private function exploit_stone_onekey_action()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'onekey_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '采石场采集成功</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '采石场采集失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 世界发言 world 1跨服 0本服
    private function chat_send($message, $world = null, $i = 1)
    {
        $c['c'] = 'chat';
        $c['m'] = 'send';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['message'] = $message . '(' . rand(1000, 9999) . ')';
        if ($world == 1) {
            $arr['world'] = $world;
        }

        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '第' . $i . '次发言:' . $arr['message'] . '---缓冲10秒</br>';
            sleep(9);
            $i++;
            $this->chat_send($message, $world, $i);
            return 1;
        } else {
            // var_dump($arr);
            echo '发言失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //端午安康-甜VS咸
    private function quyuan_festival_poll($id = 1)
    {
        $c['c'] = 'quyuan_festival';
        $c['m'] = 'poll';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['zongzi'] = $id;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '粽子已投票</br>';
            return;
        } else {
            echo '投票失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //端午安康-烧艾草
    private function quyuan_festival_burn_grass()
    {
        $c['c'] = 'quyuan_festival';
        $c['m'] = 'burn_grass';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '端午安康-烧艾草成功---缓冲6秒再烧</br>';
            sleep(5);
            $this->quyuan_festival_burn_grass();
            return;
        } else {
            echo '端午安康-烧艾草失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //幸运大转盘
    private function springlottery_index()
    {
        $c['c'] = 'springlottery';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['lottery'] > 0) {
                $this->springlottery_action();
            } else {
                echo '幸运大转盘免费次数不足</br>';
            }
            return;
        } else {
            echo '幸运大转盘打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //幸运大转盘-转动
    private function springlottery_action()
    {
        $c['c'] = 'springlottery';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '幸运大转盘已转动</br>';
            if ($res['lottery'] > 0) {
                $this->springlottery_action();
            }
            return;
        } else {
            echo '幸运大转盘转动失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //蹴鞠
    private function act_kemari_index()
    {
        $c['c'] = 'act_kemari';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开蹴鞠大赛</br>';
            foreach ($res['list'] as $v) {
                if (!$v['cd'] && $v['times'] > 0) {
                    $this->act_kemari_action($v['id']);
                }
            }
            return;
        } else {
            echo '蹴鞠打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //蹴鞠-t
    private function act_kemari_action($type)
    {
        $c['c'] = 'act_kemari';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '蹴鞠成功,获得' . $res['reward_info']['name'] . '*' . $res['reward_info']['value'] . '</br>';
            return;
        } else {
            echo '蹴鞠失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //挖矿
    public function mine_mine_now_info($ben = 1)
    {
        $c['c'] = 'mine';
        $c['m'] = 'mine_now_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开宝石矿区</br>';
            //判断现在挖的是单服还是跨服,没挖的默认单服
            //获取矿的星级
            if ($res['mine'] == 2 || $ben == 2) { //跨服
                $lv = $this->mine_server_server_index();
                echo '进入跨服' . $lv . '星矿区</br>';
                $this->mine_server_server_mine_fix($lv, 1);
                // echo '不好意思,作者进不去跨服矿所以做不出来哈哈哈哈</br>';
            } else { //单服
                $lv = $this->mine_single_index();
                echo '进入单服' . $lv . '星矿区</br>';
                $this->single_mine_fix($lv, 1);
            }
            return;
        } else {
            echo '矿场读取失败' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //获取本服挖矿星级/等级
    private function mine_single_index()
    {
        $c['c'] = 'mine';
        $c['m'] = 'single_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['p_level'] < 6) {
                return 1;
            } elseif ($res['p_level'] < 11) {
                return 2;
            } elseif ($res['p_level'] < 16) {
                return 3;
            } elseif ($res['p_level'] < 19) {
                return 4;
            } else {
                return 5;
            }
        } else {
            echo '矿场星级读取失败' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //获取跨服挖矿星级/等级
    private function mine_server_server_index()
    {
        $c['c'] = 'mine_server';
        $c['m'] = 'server_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);
        //var_dump($res);die;
        if ($res['status'] == 1) {
            if ($res['p_level'] < 6) {
                return 1;
            } elseif ($res['p_level'] < 11) {
                return 2;
            } elseif ($res['p_level'] < 16) {
                return 3;
            } elseif ($res['p_level'] < 19) {
                return 4;
            } else {
                return 5;
            }
        } else {
            echo '矿场星级读取失败' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //获取某级跨服矿区列表
    private function mine_server_server_mine_fix($lv, $p = 1, $page = null, $site = null, $type = null)
    {
        $c['c'] = 'mine_server';
        $c['m'] = 'server_mine_fix';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['star_level'] = $lv;
        $arr['p'] = $p;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            //判断有没有在挖的
            if ($res['log']) {
                if ($res['log']['dateline'] + 14401 > time()) { //挖矿4小时以后 > 现在的时间 说明没挖完呢
                    return;
                } else {
                    //收矿
                    $this->mine_server_get_silver($res['log']['site']);
                    //收完要重新请求一下数据
                    $this->mine_server_server_mine_fix($res['log']['star_level'], $p, $res['log']['page'], $res['log']['site'], $res['log']['type']);
                    return;
                }
            }
            //如果有过位置,占上次的位置
            if ($lv && $page && $site && $type) {
                $this->mine_server_server_caikuang($lv, $page, $site, $type);
                // var_dump($res['list'][$site-1]);
                foreach ($res['list'] as $vv) {
                    if ($vv['id'] == $site) {
                        //判断这个位置是不是紫
                        if ($vv['reward_type'] != 1) {
                            sleep(1);
                            //放弃
                            echo '当前矿类型' . $vv['reward_type'] . '用户要求,不放弃重开;1:银 3:黄 4:紫 6:玉石 7:声望 142:小修炼</br>';
                            // $this->mine_server_give_up();
                            // //重新获取
                            // $this->mine_server_server_mine_fix($lv,$p,$page,$site,$type);
                        }
                        return;
                    }
                }
            }
            //没有指定位置,判断中间矿有没有人,没人直接占
            if ($res['list'][4]['status'] == 0) {
                $this->mine_server_server_caikuang($res['list'][4]['star_level'], $res['list'][4]['page'], $res['list'][4]['id'], $res['list'][4]['type']);
                if ($res['list'][4]['reward_type'] != 1) {
                    //不是紫就放弃然后重新获取数据.
                    $this->mine_server_give_up();
                    //重新获取数据
                    $this->mine_server_server_mine_fix($lv, $p);
                }
                return;
            }
            foreach ($res['list'] as $v) {
                //reward_type 1:银 3:黄 4:紫   有需要可以自行判断
                if ($v['status'] == 0) {
                    $this->mine_server_server_caikuang($v['star_level'], $v['page'], $v['id'], $v['type']);
                    if ($v['reward_type'] != 1) {
                        //不是紫就放弃然后重新获取数据.
                        $this->mine_server_give_up();
                        //重新获取数据
                        $this->mine_server_server_mine_fix($lv, $p);
                    }
                    return;
                }
            }
            //走到这一步说明本页没位置,就翻下一页
            echo '跨服矿没有位置了</br>';
            // if($p < 5){
            //  $this->single_mine_fix($lv,$p+1);
            //  return;
            // }
        } else {
            echo '矿场列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //跨服收矿(未测试)
    private function mine_server_get_silver($id)
    {
        $c['c'] = 'mine_server';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['s'] = $id;
        $res = $this->post($url, $arr, [], 0);
        if ($res['silver'] > 0) {
            return;
        } else {
            echo '收矿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //放弃矿
    private function mine_server_give_up()
    {
        $c['c'] = 'mine_server';
        $c['m'] = 'give_up';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 2) {
            return;
        } else {
            echo '放弃矿矿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //跨服开采
    private function mine_server_server_caikuang($star_level, $p, $id, $t)
    {
        $c['c'] = 'mine_server';
        $c['m'] = 'server_caikuang';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['star_level'] = $star_level;
        $arr['p'] = $p;
        $arr['id'] = $id;
        $arr['t'] = $t;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '矿已开采</br>';
            return;
        } else {
            echo '开采失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //获取某级矿区列表
    private function single_mine_fix($lv, $p = 1, $page = null, $site = null, $type = null)
    {
        $c['c'] = 'mine';
        $c['m'] = 'single_mine_fix';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['star_level'] = $lv;
        $arr['p'] = $p;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            //判断有没有在挖的
            if ($res['log']) {
                if ($res['log']['dateline'] + 14401 > time()) { //挖矿4小时以后 > 现在的时间 说明没挖完呢
                    echo '时间未到/br>';
                    return;
                } else {
                    //收矿
                    $this->mine_get_silver($res['log']['site']);
                    // $this->mine_give_up();
                    //收完要重新请求一下数据
                    $this->single_mine_fix($res['log']['star_level'], $p, $res['log']['page'], $res['log']['site'], $res['log']['type']);
                    return;
                }
            }
            //如果有过位置,占上次的位置
            if ($lv && $page && $site && $type) {
                $this->mine_single_caikuang($lv, $page, $site, $type);
                foreach ($res['list'] as $vv) {
                    if ($vv['id'] == $site) {
                        //判断这个位置是不是紫
                        if ($vv['reward_type'] != 1) {
                            sleep(1);
                            //放弃
                            echo '当前矿类型' . $vv['reward_type'] . '用户要求,不放弃重开;1:银 3:黄 4:紫 6:玉石 7:声望 142:小修炼</br>';
                            // $this->mine_give_up();
                            // //重新获取
                            // $this->single_mine_fix($lv,$p,$page,$site,$type);
                        }
                        return;
                    }
                }
            }
            //没有指定位置,判断中间矿有没有人,没人直接占
            if ($res['list'][4]['status'] == 0) {
                $this->mine_single_caikuang($res['list'][4]['star_level'], $res['list'][4]['page'], $res['list'][4]['id'], $res['list'][4]['type']);
                if ($res['list'][4]['reward_type'] != 1) {
                    //不是紫就放弃然后重新获取数据.
                    sleep(1);
                    echo '当前矿类型' . $res['list'][4]['reward_type'] . '用户要求,不放弃重开;1:银 3:黄 4:紫 6:玉石 7:声望 142:小修炼</br>';
                    // $this->mine_give_up();
                    // //重新获取数据
                    // $this->single_mine_fix($lv,$p);
                }
                return;
            }
            foreach ($res['list'] as $v) {
                //reward_type 1:银 3:黄 4:紫   有需要可以自行判断
                if ($v['status'] == 0) {
                    $this->mine_single_caikuang($v['star_level'], $v['page'], $v['id'], $v['type']);
                    if ($v['reward_type'] != 1) {
                        //不是紫就放弃然后重新获取数据.
                        // $this->mine_give_up();
                        // //重新获取数据
                        // $this->single_mine_fix($lv,$p);
                    }
                    return;
                }
            }
            //走到这一步说明本页没位置,就翻下一页
            if ($p < 5) {
                $this->single_mine_fix($lv, $p + 1);
                return;
            }
        } else {
            echo '矿场列表读取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //收矿
    private function mine_get_silver($id)
    {
        $c['c'] = 'mine';
        $c['m'] = 'get_silver';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['s'] = $id;
        $res = $this->post($url, $arr, [], 0);
        if ($res['silver'] > 0) {
            return;
        } else {
            echo '收矿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //放弃矿
    private function mine_give_up()
    {
        $c['c'] = 'mine';
        $c['m'] = 'give_up';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 2 || $res['status'] == 1) {
            return;
        } else {
            echo '放弃矿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //开采
    private function mine_single_caikuang($star_level, $p, $id, $t)
    {
        $c['c'] = 'mine';
        $c['m'] = 'single_caikuang';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['star_level'] = $star_level;
        $arr['p'] = $p;
        $arr['id'] = $id;
        $arr['t'] = $t;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '矿已开采</br>';
            return;
        } else {
            echo '开采失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //演武榜
    private function arena_index($is_pk = 0)
    {
        $c['c'] = 'arena';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 2 || $res['status'] == 1) {
            $this->arena_get_reward();
            if ($is_pk) {
                $this->arena_action($res['list'][1]['uid']);
            }
            return;
        } else {
            echo '演武榜打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //演武榜-pk
    private function arena_action($t)
    {
        $c['c'] = 'arena';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['t'] = $t;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '演武榜-pk,当前排名:' . $res['info']['rank'] . '</br>';
            if ($res['info']['times'] > 0) {
                foreach ($res['info']['list'] as $v) {
                    $this->arena_action($v['uid']);
                    return;
                }
            }
            return;
        } else {
            echo '演武榜-pk失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //演武榜积分领取
    private function arena_get_reward()
    {
        $c['c'] = 'arena';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '演武榜积分领取成功</br>';
            return;
        } else {
            echo '演武榜积分领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //注册返礼列表
    private function rolegift_index()
    {
        $c['c'] = 'rolegift';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $get = 0;
            foreach ($res['list'] as $v) {
                if ($v['get'] == 1) {
                    $get = 1;
                    $this->rolegift_get_reward($v['id']);
                }
            }
            if ($get == 0) {
                echo '暂无可领注册返礼</br>';
            }
            return;
        } else {
            echo '注册返礼打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //注册返礼领取
    private function rolegift_get_reward($id)
    {
        $c['c'] = 'rolegift';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '注册返礼' . $id . '领取成功</br>';
            return;
        } else {
            echo '注册返礼' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //器械争夺列表
    private function apparatus_fight_index($num)
    {
        $c['c'] = 'apparatus_fight';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开器械争夺</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $is_pass = 0;
            foreach ($res['build_info'] as $k => $v) {
                if ($v['is_pass'] === 0) {
                    $is_pass = 1;
                    echo '获取第' . $v['build_id'] . '关守军信息</br>';
                    $ret = $this->apparatus_fight_entry_build($v['build_id']);

                    if (!$ret) {
                        return 0;
                    }
                }
                if ($k == 4 && $num > 0) {
                    $this->apparatus_fight_reset_area($num);
                }
            }
            echo '器械争夺已完成</br>';
            return;
        } else {
            echo '器械争夺打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //器械争夺获取守军信息
    private function apparatus_fight_entry_build($build_id)
    {
        $c['c'] = 'apparatus_fight';
        $c['m'] = 'entry_build';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['build_id'] = $build_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $ret = $this->apparatus_fight_action($build_id);
            // var_dump($ret);
            return $ret;
        } else {
            echo '获取第' . $build_id . '关守军信息失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //器械争夺攻击
    private function apparatus_fight_action($build_id)
    {
        $c['c'] = 'apparatus_fight';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '2s后攻击第' . $build_id . '关守军</br>';
        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '<span style="color:red;">器械争夺第' . $build_id . '关攻击成功</span></br>';
            } else {
                echo '器械争夺第' . $build_id . '关攻击失败,2s后再次尝试...</br>';
                return $this->apparatus_fight_entry_build($build_id);
            }
            return 1;
        } else {
            echo '器械争夺攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //器械争夺重置
    private function apparatus_fight_reset_area($num)
    {
        $c['c'] = 'apparatus_fight';
        $c['m'] = 'reset_area';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '器械争夺重置</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $_POST['apparatus_fight_index'][1] = $num - 1;
            $this->apparatus_fight_index($num - 1);
            return 1;
        } else {
            echo '器械争夺重置失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //武斗会报名
    private function war_entry()
    {
        $c['c'] = 'war';
        $c['m'] = 'entry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '武斗会报名成功</br>';
            return;
        } else {
            echo '武斗会报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //赛龙舟首页
    private function go_boating_boat_index()
    {
        $c['c'] = 'go_boating';
        $c['m'] = 'boat_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开赛龙舟首页</br>';
            $this->go_boating_go_boat();
            foreach ($res['reward'] as $v) {
                if ($v['status'] == 1) {
                    $this->go_boating_meter_reward($v['id']);
                }
            }
            return;
        } else {
            echo '赛龙舟首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //赛龙舟领取米数奖励
    private function go_boating_meter_reward($id)
    {
        $c['c'] = 'go_boating';
        $c['m'] = 'meter_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '赛龙舟米数奖励' . $id . '领取成功</br>';
            return;
        } else {
            echo '赛龙舟米数奖励' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //赛龙舟购买次数
    private function go_boating_buy_time($num, $i = 1)
    {
        $c['c'] = 'go_boating';
        $c['m'] = 'buy_time';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        //防止403重登数量不准,所以动态修改
        $user_name = explode(',', array_values($this->user_arr)[0])[0];
        if (!$_POST[$user_name . 'boating']) { //该用户实际购买次数
            $_POST[$user_name . 'boating'] = 1;
        }
        if ($_POST[$user_name . 'boating'] > $num) {
            return 0;
        }

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $_POST[$user_name . 'boating'] += 1;
            echo '赛龙舟购买第' . $i . '次成功</br>';
            if ($num > $i) {
                $this->go_boating_buy_time($num, $i + 1);
            }
            return;
        } else {
            echo '赛龙舟购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //赛龙舟开始
    private function go_boating_go_boat()
    {
        $c['c'] = 'go_boating';
        $c['m'] = 'go_boat';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '赛龙舟开始</br>';
            $list = implode(',', $res['direction']);
            $ret = $this->go_boating_rowing_boat($list, 1);
            return;
        } else {
            echo '赛龙舟开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //赛龙舟继续
    private function go_boating_rowing_boat($list, $i = 1)
    {
        $c['c'] = 'go_boating';
        $c['m'] = 'rowing_boat';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['list'] = $list;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '本次第' . $i . '次结果:' . $res['msg'] . '</br>';
            if ($i >= 10) {
                echo '已划动龙舟10次，退出本轮</br>';
                $this->go_boating_go_boat();
                return;
            }
            if ($res['direction']) {
                $list = implode(',', $res['direction']);
                $ret = $this->go_boating_rowing_boat($list, $i + 1);
            } else {
                echo '赛龙舟一轮结束</br>';
            }
            return;
        } else {
            if ($res['status'] == -5) {
                echo '服务器繁忙,重试</br>';
                $this->go_boating_rowing_boat($list, $i);
                return;
            }
            echo '赛龙舟继续 失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //新版赛龙舟首页
    private function dragon_boat_boat_index()
    {
        $c['c'] = 'dragon_boat';
        $c['m'] = 'boat_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开赛龙舟首页</br>';
            $this->dragon_boat_go_boat();
            foreach ($res['reward'] as $v) {
                if ($v['status'] == 1) {
                    $this->dragon_boat_meter_reward($v['id']);
                }
            }
            return;
        } else {
            echo '赛龙舟首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新版赛龙舟领取米数奖励
    private function dragon_boat_meter_reward($id)
    {
        $c['c'] = 'dragon_boat';
        $c['m'] = 'meter_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '赛龙舟米数奖励' . $id . '领取成功</br>';
            return;
        } else {
            echo '赛龙舟米数奖励' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新版赛龙舟购买次数
    private function dragon_boat_buy_time($num, $i = 1)
    {
        $c['c'] = 'dragon_boat';
        $c['m'] = 'buy_time';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        //防止403重登数量不准,所以动态修改
        $user_name = explode(',', array_values($this->user_arr)[0])[0];
        if (!$_POST[$user_name . 'boating']) { //该用户实际购买次数
            $_POST[$user_name . 'boating'] = 1;
        }
        if ($_POST[$user_name . 'boating'] > $num) {
            return 0;
        }

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $_POST[$user_name . 'boating'] += 1;
            echo '赛龙舟购买第' . $i . '次成功</br>';
            if ($num > $i) {
                $this->dragon_boat_buy_time($num, $i + 1);
            }
            return;
        } else {
            echo '赛龙舟购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新版赛龙舟开始
    private function dragon_boat_go_boat()
    {
        $c['c'] = 'dragon_boat';
        $c['m'] = 'go_boat';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '赛龙舟开始</br>';
            $list = implode(',', $res['direction']);
            $ret = $this->dragon_boat_rowing_boat($list, 1);
            return;
        } else {
            echo '赛龙舟开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新版赛龙舟继续
    private function dragon_boat_rowing_boat($list, $i = 1)
    {
        $c['c'] = 'dragon_boat';
        $c['m'] = 'rowing_boat';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['list'] = $list;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '本次第' . $i . '次结果:' . $res['msg'] . '</br>';
            if ($i >= 10) {
                echo '已划动龙舟10次，退出本轮</br>';
                $this->dragon_boat_go_boat();
                return;
            }
            if ($res['direction']) {
                $list = implode(',', $res['direction']);
                $ret = $this->dragon_boat_rowing_boat($list, $i + 1);
            } else {
                echo '赛龙舟一轮结束</br>';
            }
            return;
        } else {
            if ($res['status'] == -5) {
                echo '服务器繁忙,重试</br>';
                $this->dragon_boat_rowing_boat($list, $i);
                return;
            }
            echo '赛龙舟继续 失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //购物狂欢-夺券大赛
    private function twentyyear_shop_draw_ticket_index()
    {
        $c['c'] = 'twentyyear_shop';
        $c['m'] = 'draw_ticket_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开购物狂欢-夺券大赛</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['today_draw_num'] > 0) {
                $this->twentyyear_shop_draw_ticket();
            } else {
                echo '无可领取次数</br>';
            }
            return;
        } else {
            echo '购物狂欢-夺券大赛打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //购物狂欢-夺券大赛-动作
    private function twentyyear_shop_draw_ticket()
    {
        $c['c'] = 'twentyyear_shop';
        $c['m'] = 'draw_ticket';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '领取一张 ' . $res['ticket_info']['name'] . ' 券</br>';
            $this->twentyyear_shop_draw_ticket();
            return;
        } else {
            echo '购物狂欢-夺券大赛-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //购物狂欢-买一送一
    private function twentyyear_shop_buy_free_onece($id, $free_id)
    {
        $c['c'] = 'twentyyear_shop';
        $c['m'] = 'buy_free_onece';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['free_id'] = $free_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '购物狂欢-买一送一购买成功</br>';
            $this->twentyyear_shop_buy_free_onece($id, $free_id);
            return;
        } else {
            echo '购物狂欢-买一送一购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //新年快乐
    private function newyear_act_index()
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开新年快乐首页</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['reward'] as $v) {
                if ($v['status'] == 1) {
                    $this->newyear_act_get_sign($v['id']);
                    break;
                }
            }
            $this->newyear_act_usual_luck();
            return;
        } else {
            echo '新年快乐首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-签到
    private function newyear_act_get_sign($sign_day)
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'get_sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['sign_day'] = $sign_day;
        echo '新年快乐-签到</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '新年快乐-签到成功</br>';
            return;
        } else {
            echo '新年快乐-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-新春争夺
    private function newyear_act_city_index()
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'city_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        echo '打开新年快乐-新春争夺首页</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['city'] as $v0) {
                if ($v0['is_on'] == 1) {
                    $ret0 = $this->newyear_act_city($v0['id'], $v0['c_name']);
                    if ($ret0 == -1) {
                        return;
                    }
                    if ($ret0['remain_time'] <= 0) {
                        $this->newyear_act_harvest($v0['id'], $v0['c_name']);
                    } else {
                        echo '新年快乐-新春争夺 当前已经占领,' . $ret0['remain_time'] . '秒后可收货</br>';
                        return;
                    }
                    break;
                }
            }
            if ($res['occupy'] <= 0) {
                echo '新年快乐-新春争夺次数不足</br>';
                return;
            }
            $limit_num = array_column($res['city'], 'limit_num');
            array_multisort($limit_num, SORT_ASC, $res['city']);
            foreach ($res['city'] as $v) {
                $ret = $this->newyear_act_city($v['id'], $v['c_name']);
                if ($ret['now_num'] === '0' || $ret['now_num'] > 0) {
                    $ret = $ret['now_num'];
                } else {
                    return;
                }
                if ($ret >= 0 && $ret < $v['limit_num']) {
                    $this->newyear_act_occupy_city($v['id'], $v['c_name']);
                    break;
                }
            }
            return;
        } else {
            echo '新年快乐-新春争夺首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-新春争夺-城池明细
    private function newyear_act_city($id, $city_name)
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'city';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        echo '打开新年快乐-新春争夺-(' . $city_name . ')详情</br>';
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            return $res;
        } else {
            echo '新年快乐-新春争夺-(' . $city_name . ')详情打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return -1;
        }
    }
    //新年快乐-新春争夺-占领
    private function newyear_act_occupy_city($id, $city_name)
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'occupy_city';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        echo '占领新年快乐-新春争夺-(' . $city_name . ')</br>';
        $res = $this->post($url, $arr);
        echo '占领新年快乐-新春争夺-(' . $city_name . ')成功</br>';
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '占领新年快乐-新春争夺-(' . $city_name . ')失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-新春争夺-收货
    private function newyear_act_harvest($id, $city_name)
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'harvest';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        echo '收货新年快乐-新春争夺-(' . $city_name . ')</br>';
        $res = $this->post($url, $arr);
        echo '收货新年快乐-新春争夺-(' . $city_name . ')成功</br>';
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '收货新年快乐-新春争夺-(' . $city_name . ')失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-新年祈福
    private function newyear_act_usual_luck()
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'usual_luck';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        echo '打开新年快乐-新年祈福</br>';
        if ($res['status'] == 1) {
            if ($res['is_get'] == 0) {
                $this->chat_send_once('新年快乐');
                $this->newyear_act_get_usual_luck();
            } else {
                echo '新年快乐-新年祈福-今日已领取</br>';
            }
            return 1;
        } else {
            echo '收货新年快乐-新年祈福失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年快乐-新年祈福-领取
    private function newyear_act_get_usual_luck()
    {
        $c['c'] = 'newyear_act';
        $c['m'] = 'get_usual_luck';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '领取新年快乐-新年祈福奖励成功</br>';
            return 1;
        } else {
            echo '领取新年快乐-新年祈福奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 活动发言 world 1跨服 0本服
    private function chat_send_once($message, $world = null)
    {
        $c['c'] = 'chat';
        $c['m'] = 'send';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['message'] = $message;
        if ($world == 1) {
            $arr['world'] = $world;
        }

        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '发言成功 :' . $message . '</br>';
            return 1;
        } else {
            // var_dump($arr);
            echo '发言失败 :' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }


    //欢庆双节-签到领奖
    private function happy_double_festival_sign_index()
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        echo '打开欢庆双节-签到领奖</br>';
        if ($res['status'] == 1) {
            foreach ($res['sign_rewards'] as $v) {
                if ($v['take_status'] == 1) {
                    $this->happy_double_festival_sign();
                    break;
                }
            }
            if ($v['id'] == 6) {
                $this->happy_double_festival_take_card_reward();
            }
            return 1;
        } else {
            echo '欢庆双节-签到领奖打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-签到动作
    private function happy_double_festival_sign()
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '欢庆双节-签到成功</br>';
            return 1;
        } else {
            echo '欢庆双节-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-签到-集字手册领奖
    private function happy_double_festival_take_card_reward()
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'take_card_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '欢庆双节-签到-集字手册领奖成功</br>';
            return 1;
        } else {
            echo '欢庆双节-签到-集字手册领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-国庆探宝-战斗
    private function happy_double_festival_treasure_hunter($tribe)
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'treasure_hunter';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['tribe'] = $tribe;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['win'] > 0) {
                echo '欢庆双节-国庆探宝-第' . $res['checkpoint'] . '关攻击成功</br>';
            } else {
                echo '欢庆双节-国庆探宝-攻击失败</br>';
            }
            $this->happy_double_festival_treasure_hunter($tribe);
            return 1;
        } else {
            echo '欢庆双节-国庆探宝-开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-中秋宝盒
    private function happy_double_festival_moon_cake_box($list = '', $all_in = 1)
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'moon_cake_box';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开欢庆双节-中秋宝盒,当前祝福值:' . $res['user_luck'] . '</br>';
            if ($res['user_luck'] >= $res['drew_luck']) {
                echo '满了</br>';
                return 1;
            }
            $list = explode(' ', $list);
            if ($res['user_moon_cake']) {
                if (!$all_in) {
                    $has = false;
                    $is_take = false;
                    foreach ($res['user_moon_cake'] as $v) {
                        if ($v['id'] == $list[0]) {
                            $has = true;
                            break;
                        }
                        if ($v['is_take'] == 1) {
                            $is_take = true;
                            continue;
                        }
                    }
                    if ($is_take && !$has) {
                        $this->happy_double_festival_moon_cake_reset();
                        $this->happy_double_festival_moon_cake_box($_POST['happy_double_festival_moon_cake_box'][1], $all_in);
                        return 1;
                    }
                }
                $this->happy_double_festival_drew($all_in);
            } else {
                $s = 1;
                $a = $b = $ids = [];
                $list2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
                $list = array_unique($list + $list2);
                // var_dump($list);die;
                foreach ($list as $v) {
                    foreach ($res['s_moon_cake_arr'] as $ks => $vs) {
                        if ($v == $vs['id']) {
                            $s = $ks + 1;
                            $ids[] = $v;
                            continue 2;
                        }
                    }
                    foreach ($res['a_moon_cake_arr'] as $ka => $va) {
                        if ($v == $va['id'] && count($a) < 2) {
                            $a[] = $ka + 1;
                            $ids[] = $v;
                            continue 2;
                        }
                    }
                    foreach ($res['b_moon_cake_arr'] as $kb => $vb) {
                        if ($v == $vb['id'] && count($b) < 4) {
                            $b[] = $kb + 1;
                            $ids[] = $v;
                            continue 2;
                        }
                    }
                }
                // var_dump($list[0],$ids);die;
                $a = implode(',', $a);
                $b = implode(',', $b);
                $this->happy_double_festival_combination($s, $a, $b, $all_in);
            }
            return 1;
        } else {
            echo '打开欢庆双节-中秋宝盒失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-中秋宝盒选择动作
    private function happy_double_festival_combination($s_list, $a_list, $b_list, $all_in)
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'combination';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['s_list'] = $s_list;
        $arr['a_list'] = $a_list;
        $arr['b_list'] = $b_list;
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '欢庆双节-中秋宝盒选择成功</br>';
            $this->happy_double_festival_drew($all_in);
            return 1;
        } else {
            echo '欢庆双节-中秋宝盒选择失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-中秋宝盒抽取动作
    private function happy_double_festival_drew($all_in = 1)
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'drew';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['all_in'] = $all_in;
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '欢庆双节-中秋宝盒抽取成功' . $res['user_rewards']['0']['id'] . '</br>';
            if (!$all_in && $res['user_rewards']['0']['id'] == $_POST['happy_double_festival_moon_cake_box'][1]) {
                $this->happy_double_festival_moon_cake_reset();
            }
            $this->happy_double_festival_moon_cake_box($_POST['happy_double_festival_moon_cake_box'][1], $all_in);
            return 1;
        } else {
            echo '欢庆双节-中秋宝盒抽取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-中秋宝盒见好就收
    private function happy_double_festival_moon_cake_reset()
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'moon_cake_reset';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '欢庆双节-中秋宝盒见好就收</br>';
            return 1;
        } else {
            echo '欢庆双节-中秋宝盒见好就收失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //欢庆双节-秘宝兑换
    private function happy_double_festival_buy_shop($id)
    {
        $c['c'] = 'happy_double_festival';
        $c['m'] = 'buy_shop';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 1000000);
        if ($res['status'] == 1) {
            echo '欢庆双节-秘宝兑换' . $id . '成功</br>';
            $this->happy_double_festival_buy_shop($id);
            return 1;
        } else {
            echo '欢庆双节-秘宝兑换' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //全民翻牌-首页
    private function qm_card_index()
    {
        $c['c'] = 'qm_card';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            return 1;
        } else {
            echo '全民翻牌打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //全民翻牌
    private function qm_card_draw($num, $sign = false)
    {
        if (!$sign) {
            $this->qm_card_index();
        }
        $c['c'] = 'qm_card';
        $c['m'] = 'draw';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '翻牌成功,当前牌子:' . $res['score'] . ',剩余元宝:' . $res['gold'] . '</br>';
            if ($res['score'] >= $num) {
                return;
            } else {
                $this->qm_card_draw($num, true);
            }
            return 1;
        } else {
            echo '全民翻牌失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //全民翻牌-兑换
    private function qm_card_action_lottery($id, $sign = false)
    {
        if (!$sign) {
            $this->qm_card_index();
        }
        $c['c'] = 'qm_card';
        $c['m'] = 'action_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '翻牌兑换' . $id . '成功,剩余牌子:' . $res['list']['score'] . '</br>';
            if ($res['list']['score'] < $res['lottery_num']) {
                return;
            } else {
                $this->qm_card_action_lottery($id, true);
            }
            return 1;
        } else {
            echo '翻牌兑换' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //九周年庆-签到
    private function nine_year_sign_index()
    {
        $c['c'] = 'nine_year';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $num = 0;
            foreach ($res['sign_rewards'] as $v) {
                if ($v['take_status'] == 3) {
                    $num += 1;
                }
            }
            foreach ($res['sign_total_rewards'] as $vv) {
                if ($vv['need_day'] <= $num && $vv['is_take'] === 1) {
                    $this->nine_year_sign_total($vv['id']);
                }
            }
            return 1;
        } else {
            echo '九周年庆-签到打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //九周年庆-签到动作
    private function nine_year_sign()
    {
        $c['c'] = 'nine_year';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '九周年庆-签到成功</br>';
            return 1;
        } else {
            echo '九周年庆-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //九周年庆-签到大奖
    private function nine_year_sign_total($id)
    {
        $c['c'] = 'nine_year';
        $c['m'] = 'sign_total';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '九周年庆-签到大奖' . $id . '领取成功</br>';
            return 1;
        } else {
            echo '九周年庆-签到大奖' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //七周年庆-签到动作
    private function seven_year_sign()
    {
        $c['c'] = 'seven_year';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '七周年庆-签到成功</br>';
            return 1;
        } else {
            echo '七周年庆-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家争霸-支持列表
    private function countrys_fight_support_index($name)
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'support_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['is_support'] != 1) {
                echo '当前不可押注<br>';
                return;
            }
            $ya = false;
            foreach ($res['support_list'] as $v) {
                if ($v['name'] == $name) {
                    $this->countrys_fight_support($v['id'], 1);
                    $ya = true;
                    break;
                }
            }
            if (!$ya) {
                echo '未读取到国家[' . $name . ']请检查名字是否正确</br>';
            }
            return 1;
        } else {
            echo '国家争霸-支持列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家争霸-支持
    private function countrys_fight_support($id, $type)
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'support';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国家争霸-支持成功</br>';
        } else {
            echo '国家争霸-支持失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家争霸-报名
    private function countrys_fight_user_entry()
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'user_entry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国家争霸-报名成功</br>';
        } else {
            echo '国家争霸-报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //茱萸
    private function cornus_index()
    {
        $c['c'] = 'cornus';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $consume_cornus = array_column($res['list'], 'consume_cornus');
            array_multisort($consume_cornus, SORT_DESC, $res['list']);
            $this->cornus_buy($res['list'][0]['id']);
            return;
        } else {
            echo '茱萸-打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //茱萸-购买
    private function cornus_buy($id)
    {
        $c['c'] = 'cornus';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '茱萸-购买';
            if ($res['surplus'] > 10) {
                $consume_cornus = array_column($res['list'], 'consume_cornus');
                array_multisort($consume_cornus, SORT_DESC, $res['list']);
                unset($consume_cornus);
                $this->cornus_buy($res['list'][0]['id']);
            }
            return;
        } else {
            echo '茱萸-购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -8) {
                $this->cornus_index();
            }
            return 0;
        }
    }


    //战神殿
    private function god_index($name)
    {
        $c['c'] = 'god';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $side['left'] = 1;
            $side['right'] = 2;
            $a = 0;
            foreach ($res['info']['play'] as $k => $v) {
                if ($v['nickname'] == $name) {
                    $a = 1;
                    $this->god_support($side[$k], $v['serverid'], $v['uid']);
                    break;
                }
            }
            if (!$a) {
                echo "当前对战中没有" . $name . "</br>";
            }
            return;
        } else {
            echo '战神殿打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //战神殿押注
    private function god_support($side, $serverid, $uid)
    {
        $c['c'] = 'god';
        $c['m'] = 'support';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['side'] = $side;
        $arr['serverid'] = $serverid;
        $arr['uid'] = $uid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '战神殿押注成功</br>';
            return;
        } else {
            echo '战神殿押注失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //战神殿报名
    private function god_entry()
    {
        $c['c'] = 'god';
        $c['m'] = 'entry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '战神殿报名成功</br>';
            return;
        } else {
            echo '战神殿报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //战神殿奖励列表
    private function god_get_reward_list($type = 1)
    {
        $c['c'] = 'god';
        $c['m'] = 'get_reward_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开战神殿奖励列表</br>';
            foreach ($res['list'] as $k => $v) {
                if ($v['get'] == 0) {
                    $this->god_get_reward($type, $v['id']);
                }
            }
            if ($type == 1) {
                $this->god_get_reward_list(2);
            }
            return;
        } else {
            echo '打开战神殿奖励列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //战神殿领奖
    private function god_get_reward($type, $id)
    {
        $c['c'] = 'god';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '战神殿领奖成功</br>';
            return;
        } else {
            echo '战神殿领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    private function gjzb()
    {
        $this->countrys_fight_reward_index(1, 1);
        $this->countrys_fight_reward_index(1, 2);
        $this->countrys_fight_reward_index(1, 3);
        $this->countrys_fight_reward_index(2, 1);
        $this->countrys_fight_reward_index(2, 2);
        $this->countrys_fight_reward_index(2, 3);
        return;
    }
    //国家争霸-奖励预览
    private function countrys_fight_reward_index($play_type = 1, $r_type = 1)
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'reward_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['play_type'] = $play_type;
        $arr['r_type'] = $r_type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['reward_list'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->countrys_fight_take_reward($v['id']);
                }
            }
        } else {
            echo '国家争霸-奖励预览打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家争霸-奖励预览-领取
    private function countrys_fight_take_reward($id)
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'take_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国家争霸-领奖成功' . $id . '</br>';
        } else {
            echo '国家争霸-领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //争霸买次
    private function countrys_fight_buy_victories()
    {
        $c['c'] = 'countrys_fight';
        $c['m'] = 'buy_victories';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '国家争霸-购买次数成功</br>';
            return 1;
        } else {
            echo '国家争霸-购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //周年守护-签到
    private function years_guard_sign_index()
    {
        $c['c'] = 'years_guard';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '周年守护-签到成功</br>';
            return 1;
        } else {
            echo '周年守护-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //收集厂-掠夺
    private function shouji_lueduo($name, $num = 1)
    {
        echo '读取好友列表</br>';
        $friend = $this->get_friend_list();
        if ($friend != -1) {
            $uid = false;
            foreach ($friend as $v) {
                if ($v['nickname'] == $name) {
                    $uid = $v['fuid'];
                    break;
                }
            }
            if (!$uid) {
                echo '请先添加 ' . $name . ' 为好友再掠夺(如已添加请确认特殊字符以及有无空格),这样省去了刷Ta的时间,直接打</br>';
            } else {
                for ($i = 1; $i <= $num; $i++) {
                    $ret = $this->workshop_plunder_start($uid);
                    if ($ret > 0) {
                        echo '第' . $i . '次掠夺 ' . $name . ' 成功,缓冲2秒</br>';
                    } else {
                        echo '第' . $i . '次掠夺 ' . $name . ' 失败</br>';
                        break;
                    }
                    sleep(2);
                }
            }
        }
        return;
    }
    //收集厂-掠夺动作
    private function workshop_plunder_start($touid)
    {
        $c['c'] = 'workshop';
        $c['m'] = 'plunder_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            return $res['win'];
        } else {
            var_dump($touid, $res);
            echo '收集厂-掠夺失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //获取好友列表
    private function get_friend_list()
    {
        $c['c'] = 'friend';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = 1;
        $arr['l'] = 100;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            return $res['list'];
        } else {
            echo '获取好友列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return -1;
        }
    }


    //福从天降每日领1000元宝
    private function china_ny_take_red_money()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'take_red_money';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '福从天降-财运红包领取成功,剩余元宝:' . $res['gold'] . '</br>';
            return;
        } else {
            echo '福从天降-财运红包领取失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-欢乐竞猜
    private function china_ny_bet()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'bet';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['site1'] = 1;
        $c['site2'] = 2;
        $c['site3'] = 3;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '福从天降-欢乐竞猜成功</br>';
            return;
        } else {
            echo '福从天降-欢乐竞猜失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-欢乐竞猜领取
    private function china_ny_take_bet()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'take_bet';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '福从天降-欢乐竞猜奖励领取成功</br>';
            return;
        } else {
            echo '福从天降-欢乐竞猜奖励领取失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-福将目标页面
    private function china_ny_target_index()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'target_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['user_target_info'] as $v) {
                if ($res['now_day'] == 1) {
                    if ($v['day'] == $res['now_day'] && $v['is_take'] == 0) {
                        //购买武将
                        $this->tavern_get_list();
                        //领取奖励
                        $this->china_ny_take_target();
                        return;
                    }
                } else {
                    echo '福从天降-福将目标第' . $res['now_day'] . '天任务亏本,跳过</br>';
                    return;
                }
            }
        } else {
            echo '福从天降-福将目标打开失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-福将目标领取
    private function china_ny_take_target()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'take_target';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '福从天降-福将目标奖励领取成功</br>';
            return;
        } else {
            echo '福从天降-福将目标领取失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-每日签到
    private function china_ny_sign()
    {
        $c['c'] = 'china_ny';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['sign_type'] = 1;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '福从天降-每日签到领取成功</br>';
            return;
        } else {
            echo '福从天降-每日签到失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //福从天降-福将目标第一天购买最便宜的一个可购买紫将
    // private function tavern_get_list(){
    //  $c['c'] = 'tavern';
    //  $c['m'] = 'get_list';
    //  $c['token_uid'] = $this->token_uid;
    //  $c['token'] = $this->token;
    //  $url = $this->transformation_url($c,$this->token);
    //  $arr['token'] = $this->token;
    //  $arr['page'] = 1;
    //  $arr['perpage'] = 9;
    //  $arr['tab'] = 2;
    //  $res = $this->post($url,$arr);
    //  if($res['status'] == 1){
    //      foreach($res['list'] as $v){
    //          if($v['paytype'] == 3 && $v['isown'] == 0){//没买过的第一个紫宝石将领
    //              $ret = $this->tavern_buy($v['generalid'],$v['info']['name']);
    //              if($ret == 1){
    //                  return;
    //              }else{
    //                  return 0;
    //              }
    //          }
    //      }
    //      echo '名将榜全买过了,没有可购买的武将,请去手动完成福从天降-福将目标第一天任务</br>';
    //      return 0;
    //  }else{
    //      echo '福从天降-福将目标第一天任务失败:'.$res['msg'].'</br>';
    //      return 0;
    //  }
    // }
    //直接买突飞
    private function tavern_get_list()
    {
        $c['c'] = 'tavern';
        $c['m'] = 'get_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['page'] = 1;
        $arr['perpage'] = 9;
        $arr['tab'] = 3;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $ret = $this->tavern_buy($res[0]['generalid'], '突飞卡');
            if ($ret == 1) {
                return 1;
            } else {
                return 0;
            }
            return 0;
        } else {
            echo '福从天降-福将目标第一天任务失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }
    //酒馆购买
    private function tavern_buy($id, $name, $num = 1)
    {
        $c['c'] = 'tavern';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['generalid'] = $id;
        $arr['num'] = $num;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo $name . ' 购买成功</br>';
            return 1;
        } else {
            echo $name . ' 购买失败:' . $res['msg'] . '</br>';
            return 0;
        }
    }

    //将魂升级
    private function soul_up($num, $type, $lv, $page = 1)
    {
        echo '打开第' . $page . '页将魂</br>';
        $index = $this->soul_get_pack_info($page);
        $bz = 0;
        foreach ($index['info']['list'] as $v) {
            if ($v['type'] == $type && $v['level'] < $lv && $v['quality'] == 5) {
                echo '准备升级</br>';
                //可升级
                $ret = $this->soul_levelup($v['id'], $lv);
                if ($ret > 0) {
                    $num -= 1;
                } else {
                    return;
                }
                if ($num <= 0) {
                    echo '将魂升级已完成</br>';
                    return;
                }
            }
        }
        if ($index['info']['page'] < $index['info']['pages']) {
            echo '本页已无符合条件的将魂,打开下一页</br>';
            $this->soul_up($num, $type, $lv, $page + 1);
        } else {
            echo '没有lv' . $lv . '以下的将魂' . $type . '</br>';
        }
        return;
    }
    //打开将魂首页
    private function soul_get_pack_info($page = 1)
    {
        $c['c'] = 'soul';
        $c['m'] = 'get_pack_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['page'] = $page;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开将魂首页成功</br>';
            return $res;
        } else {
            echo '打开将魂首页失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂升级动作
    private function soul_levelup($sid, $lv)
    {
        $c['c'] = 'soul';
        $c['m'] = 'levelup';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['sid'] = $sid;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '升级成功,当前等级:' . $res['info']['now']['level'] . '</br>';
            if ($lv > $res['info']['now']['level']) {
                return $this->soul_levelup($sid, $lv);
            }
            // var_dump($res);die;
            return $res['info']['now']['level'];
        } else {
            echo '升级失败:' . $res['msg'] . ',状态码:' . $res['status'] . '(2等级已满 3元魂不足 -1等级不足 -2将魂信息获取失败)</br>';
            return 0;
        }
    }
    //打开将魂合成页
    private function soul_merge_index($num = 10, $num2 = 0)
    {
        // var_dump($num,$num2);die;
        if ($num <= $num2) {
            return 0;
        }
        $c['c'] = 'soul';
        $c['m'] = 'merge_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['page'] = 1;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开将魂合成页成功</br>';
            // var_dump($res['pack']['list']);die;
            if ($res['pack']['list'][1]) {
                $this->soul_merge_action($res['pack']['list'][0]['id'], $res['pack']['list'][1]['id'], $num, $num2);
            }
            return 1;
        } else {
            echo '打开将魂合成页失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //将魂合成
    private function soul_merge_action($sid1, $sid2, $num, $num2)
    {
        $c['c'] = 'soul';
        $c['m'] = 'merge_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['sid1'] = $sid1;
        $arr['sid2'] = $sid2;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '合成成功</br>';
            $this->soul_merge_index($num, $num2 + 1);
            return 1;
        } else {
            echo '合成失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家设宴首页
    private function banquet_index($type, $qk = 0)
    {
        $c['c'] = 'banquet';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        echo '打开国家设宴首页</br>';
        if ($res['status'] == 1) {
            if ($res['team']) {
                echo '当前已在宴会中</br>';
                return 0;
            }
            if ($res['info']['times'] <= 0) {
                echo '次数不足</br>';
                return 0;
            }
            $has = 0;
            foreach ($res['list'] as $v) {
                if ($v['type'] == $type) {
                    $has = 1;
                    echo '准备加入' . $v['nickname'] . '的设宴</br>';
                    $this->banquet_join_team($v['caption']);
                    return;
                }
            }
            if (!$has) {
                echo '当前无符合条件的宴会,自己创建</br>';
                $this->banquet_create_team($type);
                if ($qk) {
                    $this->banquet_action(1);
                }
            }
            return 1;
        } else {
            echo '打开国家设宴首页失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家设宴-加入
    private function banquet_join_team($id)
    {
        $c['c'] = 'banquet';
        $c['m'] = 'join_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '加入设宴成功</br>';
            return 1;
        } else {
            echo '加入国家设宴失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家设宴-创建
    private function banquet_create_team($id)
    {
        $c['c'] = 'banquet';
        $c['m'] = 'create_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '创建设宴成功</br>';
            return 1;
        } else {
            echo '创建国家设宴失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家设宴-霸王宴
    private function banquet_action($type = 1)
    {
        $c['c'] = 'banquet';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '强开设宴成功</br>';
            return 1;
        } else {
            echo '强开国家设宴失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //群雄争霸
    private function hero_fight_stage_twodetect($times = 0)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'stage_twodetect';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);

        echo '打开群雄争霸</br>';
        if ($res['status'] == 1) {
            if ($res['user_info']['card'] <= 0 && $res['list_status'] == 0) {
                echo '次数不足</br>';
                if ($times <= 0) {
                    return 0;
                } else {
                    echo '购买次数</br>';
                    $times = $times - 1;
                }
            }
            $this->hero_fight_stage_twoindex($times);
            return 1;
        } else {
            echo '打开群雄争霸失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-入场
    private function hero_fight_stage_twoindex($times)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'stage_twoindex';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);

        echo '群雄争霸-入场</br>';
        if ($res['status'] == 1) {
            $limit_num = array_column($res['pk_list'], 'level');
            array_multisort($limit_num, SORT_ASC, $res['pk_list']);
            foreach ($res['pk_list'] as $v) {
                if ($v['is_pk'] == 0) {
                    echo '群雄争霸-pk(lv.' . $v['level'] . ' - ' . $v['nickname'] . ')</br>';
                    sleep(1);
                    $this->hero_fight_integral_pk($v['server_id'], $v['uid'], $times);
                    break;
                }
            }
            return 1;
        } else {
            echo '群雄争霸-入场失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-战斗
    private function hero_fight_integral_pk($server_id, $pk_uid, $times)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'integral_pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['server_id'] = $server_id;
        $arr['pk_uid'] = $pk_uid;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '战斗胜利</br>';
            } else {
                echo '战斗失败</br>';
            }
            $this->hero_fight_stage_twodetect($times);
            return 1;
        } else {
            echo '群雄争霸-pk失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -13) {
                $this->hero_fight_integral_pk($server_id, $pk_uid, $times);
            }
            return 0;
        }
    }
    //群雄争霸-押注界面
    private function hero_fight_arena_index($nickname, $pk_group = 3)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'arena_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['pk_group'] = $pk_group;
        $res = $this->post($url, $arr, [], 0);

        echo '打开群雄争霸-押注</br>';
        if ($res['status'] == 1) {
            $sign = 0;
            foreach ($res['rank_list'] as $v) {
                if ($v['nickname'] == $nickname) {
                    $this->hero_fight_bet_arena($v['uid'], $v['server_id'], $v['pk_group']);
                    $sign = 1;
                    break;
                }
            }
            if (!$sign) {
                echo '当前组别没有找到{' . $nickname . '},打开下一组...</br>';
                if ($pk_group == 1) {
                    echo '没有下一组了...</br>';
                    return;
                }
                $this->hero_fight_arena_index($nickname, $pk_group - 1);
            }
            return 1;
        } else {
            echo '打开群雄争霸失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-押注
    private function hero_fight_bet_arena($bet_uid, $serverid, $pk_group)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'bet_arena';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['bet_uid'] = $bet_uid;
        $arr['serverid'] = $serverid;
        $arr['pk_group'] = $pk_group;
        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '打开群雄争霸-押注成功</br>';
            return 1;
        } else {
            echo '群雄争霸-押注失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-报名
    private function hero_fight_entry()
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'entry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '群雄争霸-报名成功</br>';
            return 1;
        } else {
            echo '群雄争霸-报名失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-领奖
    private function hero_fight_take_reward($id)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'take_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '群雄争霸-领奖' . $id . '成功</br>';
            return 1;
        } else {
            echo '群雄争霸-领奖' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //群雄争霸-领奖列表
    private function hero_fight_reward_index($type = 1)
    {
        $c['c'] = 'hero_fight';
        $c['m'] = 'reward_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $res = $this->post($url, $arr, [], 0);

        if ($res['status'] == 1) {
            echo '打开群雄争霸-领奖列表' . $type . '成功</br>';
            foreach ($res['reward_info'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->hero_fight_take_reward($v['id']);
                }
            }
            if ($type < 4) {
                $this->hero_fight_reward_index($type + 1);
            }
            return 1;
        } else {
            echo '打开群雄争霸-领奖列表' . $type . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国家列表-搜索
    private function country_search($name)
    {
        // if($this->member_info['vip'] == 0){
        //  echo $this->member_info['vip'].'v0不加国家</br>';
        //  return;
        // }
        // if($this->member_info['silver'] < 100256868){
        //  echo $this->member_info['silver'].'银币太少,不加国家</br>';
        //  return;
        // }
        $c['c'] = 'country';
        $c['m'] = 'search';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['name'] = $name;
        $res = $this->post($url, $arr);

        echo '搜索国家 ' . $name . ' </br>';
        if ($res['status'] == 1) {
            $this->country_apply($res['country']['id'], 1);
            return $res;
        } else {
            echo '搜索国家 ' . $name . ' 失败:' . $res['msg'] . ',状态码:' . $res['status'] . ',-2国家不存在 -1等级不足</br>';
            return 0;
        }
    }
    //申请国家
    private function country_apply($id, $page = 1)
    {
        $c['c'] = 'country';
        $c['m'] = 'apply';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['page'] = $page;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '申请成功</br>';
            return 1;
        } else {
            echo '申请国家失败:' . $res['msg'] . ',状态码:' . $res['status'] . ',-4申请失败 -3已经申请过 -2国家不存在 -1当前有国家 2国家已满 -3等级不足</br>';
            return 0;
        }
    }
    //银币捐献
    private function country_donate_preview()
    {
        $c['c'] = 'country';
        $c['m'] = 'donate_preview';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['type'] = 1;
        $c['num'] = 1;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            if ($this->member_info['vip'] > 0) {
                echo '此账号v' . $this->member_info['vip'] . ',可捐献' . $res['max_silver_times'] . '次</br>';
                $this->country_donate(1, $res['max_silver_times']);
            } else {
                echo '此账号v0,可捐献' . $res['max_silver_times'] . '次</br>';
                for ($i = 0; $i < $res['max_silver_times']; $i++) {
                    $this->country_donate(1, 1);
                }
            }
            return 1;
        } else {
            echo '捐献失败1:' . $res['msg'] . ',状态码:' . $res['status'] . ',-4申请失败 -3已经申请过 -2国家不存在 -1当前有国家 2国家已满 -3等级不足</br>';
            return 0;
        }
    }
    //捐献
    private function country_donate($type = 1, $num = 1)
    {
        $c['c'] = 'country';
        $c['m'] = 'donate';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['num'] = $num;
        $res = $this->post($url, $arr, [], $num > 1 ? 1000000 : 0);

        if ($res['status'] == 1) {
            echo '捐献成功 ';
            return 1;
        } else {
            echo '捐献失败2:' . $res['msg'] . ',状态码:' . $res['status'] . ',-4申请失败 -3已经申请过 -2国家不存在 -1当前有国家 2国家已满 -3等级不足</br>';
            return 0;
        }
    }
    //清气泡
    private function message_update_read_status()
    {
        $c['c'] = 'message';
        $c['m'] = 'update_read_status';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = 7;
        $res = $this->post($url, $arr);

        if ($res['status'] == 1) {
            echo '气泡清除成功</br>';
            return 1;
        } else {
            echo '气泡清除失败:' . $res['msg'] . ',状态码:' . $res['status'] . ',-4申请失败 -3已经申请过 -2国家不存在 -1当前有国家 2国家已满 -3等级不足</br>';
            return 0;
        }
    }

    //打开贤才征辟
    private function guess_lantern_riddle_index()
    {
        $c['c'] = 'guess_lantern_riddle';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        echo '打开贤才征辟</br>';
        if ($res['status'] == 1) {
            if (!$res['ques_status']) {
                echo '次数不足</br>';
                return;
            }
            echo '开始答题</br>';
            $this->guess_lantern_riddle_action();
            return 1;
        } else {
            echo '贤才征辟打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //贤才征辟-开始
    private function guess_lantern_riddle_action()
    {
        $c['c'] = 'guess_lantern_riddle';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '第' . $res['now_ques'] . '题...</br>';
            $this->guess_lantern_riddle_fix_answer($res['ques_info']['id'], 'a');
            return 1;
        } else {
            echo '贤才征辟开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //贤才征辟-继续答题
    private function guess_lantern_riddle_fix_answer($quertion, $answer)
    {
        $c['c'] = 'guess_lantern_riddle';
        $c['m'] = 'fix_answer';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['quertion'] = $quertion;
        $arr['answer'] = $answer;
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '第' . $res['now_ques'] . '题...</br>';
            if ($res['now_ques'] <= $res['all_ques'] && $res['next_ques']) {
                $this->guess_lantern_riddle_fix_answer($res['next_ques']['id'], 'a');
            }
            return 1;
        } else {
            echo '贤才征辟继续失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //贤才征辟-往期奖励
    private function guess_lantern_riddle_receive_rank_reward()
    {
        $c['c'] = 'guess_lantern_riddle';
        $c['m'] = 'receive_rank_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '贤才征辟-往期奖励领取成功</br>';
            return 1;
        } else {
            echo '贤才征辟-往期奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //装备扫荡
    public function zbsd()
    {
        for ($i = 2; $i <= 6; $i++) {
            $this->sophistication_equip_guide(1, $i);
            $this->sophistication_equip_guide(3, $i);
            $this->sophistication_equip_guide(4, $i);
        }
    }
    //装备扫荡列表
    private function sophistication_equip_guide($type, $quality)
    {
        $c['c'] = 'sophistication';
        $c['m'] = 'equip_guide';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['quality'] = $quality;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $this->sophistication_sweep($type, $quality);
            return 1;
        } else {
            echo '装备扫荡列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //装备扫荡动作
    private function sophistication_sweep($type, $quality)
    {
        $c['c'] = 'sophistication';
        $c['m'] = 'sweep';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['quality'] = $quality;
        $arr['check'] = 1;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            foreach ($res['reel'] as $v) {
                echo '扫荡成功,获得道具:' . $v['itemname'] . '*' . $v['num'] . '</br>';
            }
            return 1;
        } else {
            echo '装备扫荡失败:' . $res['msg'] . ',状态码:' . $res['status'] . ';-8没有可扫荡的关卡 -9军令不足 -10无上阵武将</br>';
            return 0;
        }
    }

    //谏言
    private function expostulation_index()
    {
        $c['c'] = 'expostulation';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '谏言打开成功</br>';
            if ($res['list']['0']['status'] == 2) {
                $this->expostulation_get_reward($res['list']['0']['id']);
            } elseif ($res['list']['0']) {
                $this->expostulation_support($res['list']['0']['id']);
            }
            return 1;
        } else {
            echo '谏言打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //谏言-支持
    private function expostulation_support($id)
    {
        $c['c'] = 'expostulation';
        $c['m'] = 'support';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '谏言-支持成功</br>';
            return 1;
        } else {
            echo '谏言-支持失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //谏言-领取
    private function expostulation_get_reward($id)
    {
        $c['c'] = 'expostulation';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '谏言-领取成功</br>';
            return 1;
        } else {
            echo '谏言-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //国矿首页
    private function countrymine_index()
    {
        $c['c'] = 'countrymine';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国矿抢夺-首页打开成功</br>';
            if ($res['log']) {
                $this->countrymine_get_reward($res['log']['site']);
            }
            $this->countrymine_rob(1, 1, 1);
            return 1;
        } else {
            echo '国矿抢夺-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国矿-开采
    private function countrymine_caikuang($p = 1, $id = 1, $t = 1)
    {
        $c['c'] = 'countrymine';
        $c['m'] = 'caikuang';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;
        $arr['id'] = $id;
        $arr['t'] = $t;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国矿抢夺-开采成功</br>';
            return 1;
        } else {
            echo '国矿抢夺-开采失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国矿-收
    private function countrymine_get_reward($s)
    {
        $c['c'] = 'countrymine';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['s'] = $s;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国矿抢夺-收成功</br>';
            return 1;
        } else {
            echo '国矿抢夺-收失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国矿抢夺
    private function countrymine_rob($p = 1, $id = 1, $t = 1)
    {
        $c['c'] = 'countrymine';
        $c['m'] = 'rob';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;
        $arr['id'] = $id;
        $arr['t'] = $t;
        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '国矿抢夺-打矿成功</br>';
            return 1;
        } else {
            echo '国矿抢夺-打矿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //太平要数首页
    private function peace_art_index()
    {
        $c['c'] = 'peace_art';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            return $res;
        } else {
            echo '太平要数首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    public function peace_art_pk()
    {
        $res = $this->peace_art_index();
        if ($res['status'] == 1) {
            if (count($res['team']) != 5) {
                echo '当前队伍人数不足,请组满再用该功能</br>';
                return 0;
            }
            echo '等待2s攻击太平要数</br>';
            $this->peace_art_team_action($res['team_id']);
            return 1;
        }
    }
    //太平要数购买次数
    private function peace_art_buy_times()
    {
        $res0 = $this->peace_art_index();
        if ($res0['status'] == 1) {
            $c['c'] = 'peace_art';
            $c['m'] = 'buy_times';
            $c['token_uid'] = $this->token_uid;
            $c['token'] = $this->token;
            $url = $this->transformation_url($c, $this->token);
            $arr['token'] = $this->token;
            $arr['times'] = $res0['can_buy_times'] - $res0['today_buy_times'];
            $arr['t'] = 1;

            $res = $this->post($url, $arr);
            if ($res['status'] == 1) {
                echo '太平要数购买次数成功</br>';
                $this->peace_art_team_action($res['team_id']);
                return 1;
            } else {
                echo '太平要数购买次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
                return 0;
            }
        }
    }
    //太平要数攻击
    private function peace_art_team_action($id)
    {
        $c['c'] = 'peace_art';
        $c['m'] = 'team_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            if ($res['win'] >= 1) {
                echo '太平要数攻击成功...等待2s</br>';
                $this->peace_art_team_action($id);
            } else {
                echo '当前队伍配置到头了,没打过</br>';
            }
            return 1;
        } else {
            echo '太平要数攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //太平要数队伍列表
    private function peace_art_team_hall_index($page = null)
    {
        $c['c'] = 'peace_art';
        $c['m'] = 'team_hall_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        if ($page) {
            $arr['page'] = $page;
        }

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['is_join_team'] == 1) {
                //有队伍就退队
                echo '当前有队伍,需要退队</br>';
                $this->peace_art_quit_team($res['team_info'][0]['id']);
            }
            if ($res['all_page'] > $page) {
                echo '直接翻页进入最后(最新创建)一队</br>';
                $this->peace_art_team_hall_index($res['all_page']);
                return;
            }
            $team_info = array_reverse($res['team_info']);
            $this->peace_art_quick_join_team($team_info[0]['id']);
            return 1;
        } else {
            echo '太平要数队伍列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //太平要数加入队伍
    private function peace_art_quick_join_team($id)
    {
        $c['c'] = 'peace_art';
        $c['m'] = 'quick_join_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '太平要数加入队伍成功</br>';
            return 1;
        } else {
            echo '太平要数加入队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //太平要数退出队伍
    private function peace_art_quit_team($id)
    {
        $c['c'] = 'peace_art';
        $c['m'] = 'quit_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '太平要数退出队伍成功</br>';
            return 1;
        } else {
            echo '太平要数退出队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //铜雀台详情
    private function beauty_get_beauty_info($beauty_id)
    {
        $c['c'] = 'beauty';
        $c['m'] = 'get_beauty_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['beauty_id'] = $beauty_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            $bz = 0;
            foreach ($res['beauty_info']['chip'] as $v) {
                if ($v['own'] == 0) {
                    echo '发现碎片' . $v['chip_id'] . '可以抢夺</br>';
                    $ret = $this->beauty_loot_index($beauty_id, $v['chip_id']);
                    if ($ret == 0) {
                        return;
                    }
                    $bz = 1;
                }
            }
            if ($bz == 0) {
                echo '碎片已满,无可抢夺碎片</br>';
            }
            return 1;
        } else {
            echo '铜雀台详情打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //铜雀台问候
    private function beauty_active_action($beauty_id)
    {
        $c['c'] = 'beauty';
        $c['m'] = 'active_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['beauty_id'] = $beauty_id;
        $arr['type'] = 1;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '铜雀台问候成功...</br>';
            $this->beauty_active_action($beauty_id);
            return 1;
        } else {
            echo '铜雀台问候失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //铜雀台碎片抢夺详情
    private function beauty_loot_index($beauty_id, $chip_id)
    {
        $c['c'] = 'beauty';
        $c['m'] = 'loot_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['beauty_id'] = $beauty_id;
        $arr['chip_id'] = $chip_id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['free_times'] == 0) {
                echo '铜雀台抢夺次数不足</br>';
                return 0;
            }
            $this->beauty_loot_action($beauty_id, $chip_id, end($res['loot_list'])['uid']);
            return 1;
        } else {
            echo '铜雀台碎片抢夺详情打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //铜雀台抢夺动作
    private function beauty_loot_action($beauty_id, $chip_id, $t)
    {
        $c['c'] = 'beauty';
        $c['m'] = 'loot_action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['beauty_id'] = $beauty_id;
        $arr['chip_id'] = $chip_id;
        $arr['t'] = $t;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                if ($res['b_info']['chip_status'] == 1) {
                    echo '铜雀台抢夺成功,获得碎片</br>';
                } else {
                    echo '铜雀台抢夺成功,但是未获得碎片</br>';
                }
            } else {
                echo '铜雀台抢夺没打过人家</br>';
            }
            $this->beauty_loot_index($beauty_id, $chip_id);
            return 1;
        } else {
            echo '铜雀台抢夺失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //点将台抽卡首页
    private function general_break_through_draw_index()
    {
        $c['c'] = 'general_break_through';
        $c['m'] = 'draw_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['times'] > 0) {
                echo '点将台抽卡...</br>';
                $this->general_break_through_draw_card(2, 1);
            } else {
                echo '点将台抽卡次数不足</br>';
            }
            return 1;
        } else {
            echo '点将台抽卡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //点将台抽卡
    private function general_break_through_draw_card($pond_id = 2, $type = 1)
    {
        $c['c'] = 'general_break_through';
        $c['m'] = 'draw_card';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['pond_id'] = $pond_id;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '点将台抽卡成功...</br>';
            return 1;
        } else {
            echo '点将台抽卡失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //好友领赠
    private function friend_onekey_receive_give()
    {
        $c['c'] = 'friend';
        $c['m'] = 'onekey_receive_give';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        echo $res['msg'] . ',状态码:' . $res['status'] . '</br>';
        return 0;
    }

    //回馈
    private function vipreward_index()
    {
        $c['c'] = 'vipreward';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['list'] as $v) {
                if ($v['status'] == 1) {
                    $this->vipreward_get_reward($v['id']);
                }
            }
            return 1;
        } else {
            echo '回馈打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //回馈-领取
    private function vipreward_get_reward($id)
    {
        $c['c'] = 'vipreward';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '回馈' . $id . '领取成功</br>';
            return 1;
        } else {
            echo '回馈' . $id . '领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //圣诞奇缘-圣诞祝语
    private function christmas_second_letters_index()
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'letters_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开圣诞奇缘-圣诞祝语</br>';
            if ($res['user_count_letters'] > 0) {
                $this->christmas_second_write_letters();
            }
            for ($i = 1; $i <= 5; $i++) {
                $this->christmas_second_read_letters($res['letters_info_id'][$i]['id']);
            }
            foreach ($res['letters_achieve'] as $v) {
                if ($v['is_take'] != 2) {
                    $this->christmas_second_take_letters_achieve($v['id']);
                }
            }
            return 1;
        } else {
            echo '圣诞奇缘-圣诞祝语打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-圣诞祝语-领奖
    private function christmas_second_take_letters_achieve($id)
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'take_letters_achieve';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-圣诞祝语-领奖成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-圣诞祝语-领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-圣诞祝语-拆信
    private function christmas_second_read_letters($id)
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'read_letters';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-圣诞祝语-拆信成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-圣诞祝语-拆信失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-圣诞祝语-写信
    private function christmas_second_write_letters()
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'write_letters';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['messige'] = '暴走无双七周年快乐';
        $arr['auto'] = 1;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-圣诞祝语-写信成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-圣诞祝语-写信失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-驯鹿奇缘
    private function christmas_second_reindeer_fate()
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'reindeer_fate';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开圣诞奇缘-驯鹿奇缘</br>';
            foreach ($res['task_info'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->christmas_second_onekey_take_task();
                    $this->christmas_second_reindeer_fate();
                    break;
                }
            }
            foreach ($res['reindeer_info'] as $vv) {
                if ($vv['is_take'] == 1) {
                    $this->christmas_second_take_reindeer_integral($vv['id']);
                }
            }
            return 1;
        } else {
            echo '圣诞奇缘-驯鹿奇缘打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-驯鹿奇缘-积分领取
    private function christmas_second_onekey_take_task()
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'onekey_take_task';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-驯鹿奇缘-' . $res['add_integral'] . '积分领取成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-驯鹿奇缘-积分领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-驯鹿奇缘-积分奖励领取
    private function christmas_second_take_reindeer_integral($id)
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'take_reindeer_integral';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-驯鹿奇缘-积分奖励' . $id . '领取成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-驯鹿奇缘-积分奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-装扮圣诞树
    private function christmas_second_tree_index()
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'tree_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开圣诞奇缘-装扮圣诞树</br>';
            foreach ($res['christmas_tree'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->christmas_second_take_tree($v['id']);
                    break;
                }
            }
            return 1;
        } else {
            echo '圣诞奇缘-装扮圣诞树打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //圣诞奇缘-装扮圣诞树-奖励领取
    private function christmas_second_take_tree($id)
    {
        $c['c'] = 'christmas_second';
        $c['m'] = 'take_tree';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            echo '圣诞奇缘-装扮圣诞树-奖励' . $id . '领取成功</br>';
            return 1;
        } else {
            echo '圣诞奇缘-装扮圣诞树-奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //大亨-首页
    private function national_day_boss_super_boss_reward($kind)
    {
        $c['c'] = 'national_day_boss';
        $c['m'] = 'super_boss_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['kind'] = $kind;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '大亨-首页</br>';
            $wish_id = $res['user_boss_wish']['wish_id'] == $res['draw_info'][0]['id'] ? $res['draw_info'][1]['id'] : $res['draw_info'][0]['id'];
            if (!$this->national_day_boss_set_wish($wish_id)) {
                return 0;
            }
            for ($i = 0; $i <= 8; $i++) {
                $ret = $this->national_day_boss_draw($kind, 0);
                if ($ret == -9) {
                    return 0;
                }
            }
            $this->national_day_boss_super_boss_reward($kind);
            return 1;
        } else {
            echo '大亨-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //大亨-十连
    private function national_day_boss_draw($kind, $is_token = 0)
    {
        $c['c'] = 'national_day_boss';
        $c['m'] = 'draw';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['kind'] = $kind;
        $arr['is_token'] = $is_token;
        $arr['num'] = 10;

        $res = $this->post($url, $arr, [], 3500000);
        if ($res['status'] == 1) {
            echo '大亨-十连...</br>';
            foreach ($res['rewards'] as $v) {
                if ($v['is_wish'] > 0) {
                    echo '大亨-中大亨了...请手动处理</br>';
                    die;
                }
            }
            return 1;
        } else {
            echo '大亨-十连失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return $res['status'];
        }
    }
    //大亨-修改心愿
    private function national_day_boss_set_wish($id)
    {
        $c['c'] = 'national_day_boss';
        $c['m'] = 'set_wish';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 4000000);
        if ($res['status'] == 1) {
            echo '大亨-修改心愿' . $id . '成功</br>';
            return 1;
        } else {
            echo '大亨-修改心愿' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //大亨-仓库
    private function national_day_boss_warehouse_index()
    {
        $c['c'] = 'national_day_boss';
        $c['m'] = 'warehouse_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '大亨-打开仓库</br>';
            $listarr = [];
            foreach ($res['user_warehouse'] as $k => $v) {
                if ($k <= 11) {
                    $listarr[] = $v['id'];
                } else {
                    break;
                }
            }
            if (!$listarr) {
                return 1;
            }
            $list = implode(',', $listarr);
            $this->national_day_boss_sale_warehouse($list);
            $this->national_day_boss_warehouse_index();
            return 1;
        } else {
            echo '大亨-仓库打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //大亨-出售
    private function national_day_boss_sale_warehouse($list)
    {
        $c['c'] = 'national_day_boss';
        $c['m'] = 'sale_warehouse';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['list'] = $list;

        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            echo '大亨-出售成功</br>';
            return 1;
        } else {
            echo '大亨-出售失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //金鸡报晓-领取
    private function chicken_get_vip_reward()
    {
        $c['c'] = 'chicken';
        $c['m'] = 'get_vip_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '金鸡报晓-领取成功</br>';
            return 1;
        } else {
            echo '金鸡报晓-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //超级团购-银币
    private function big_team_buy_buy($id)
    {
        $c['c'] = 'big_team_buy';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '超级团购-买第' . $id . '个成功</br>';
            return 1;
        } else {
            echo '超级团购-买第' . $id . '个失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //三才比武-首页
    private function three_talents_pk_index()
    {
        $c['c'] = 'three_talents_pk';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['user_info']['times'] == 0) {
                echo '三才比武次数不足</br>';
                return 0;
            }
            $this->three_talents_pk_action($res['play_list'][5]['uid'], $res['play_list'][5]['pk_group'], 5);
            return 1;
        } else {
            echo '三才比武-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //三才比武-攻击
    private function three_talents_pk_action($pk_uid, $to_group, $pk_num)
    {
        $c['c'] = 'three_talents_pk';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['pk_uid'] = $pk_uid;
        $arr['to_group'] = $to_group;
        $arr['pk_num'] = $pk_num;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '三才比武-攻击成功</br>';
            $this->three_talents_pk_index();
            return 1;
        } else {
            echo '三才比武-攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //夜袭乌巢-创建队伍
    private function night_attack_nest_plunder_team($id = 33)
    {
        $c['c'] = 'night_attack_nest';
        $c['m'] = 'plunder_team';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夜袭乌巢-创建队伍成功</br>';
            $this->night_attack_nest_plunder_start();
            return 1;
        } else {
            echo '夜袭乌巢-创建队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夜袭乌巢-开战
    private function night_attack_nest_plunder_start()
    {
        $c['c'] = 'night_attack_nest';
        $c['m'] = 'plunder_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夜袭乌巢-开战成功,打没打过不管</br>';
            return 1;
        } else {
            echo '夜袭乌巢-开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //征战八方-首页
    private function act_fight_index($times = 0)
    {
        $c['c'] = 'act_fight';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开征战八方首页</br>';
            foreach ($res['info'] as $v) {
                if ($v['status'] == 1) {
                    $this->act_fight_get_reward($v['id']);
                }
            }
            if ($times > 0) {
                $times1 = $this->act_fight_get_achievement_info();
                $times2 = intval($res['lottery_num'] / 3);
                if ($times1 + $times2 >= $times && $times > $times1) {
                    $this->act_fight_lottery(1, $times - $times1);
                }
            }
            return 1;
        } else {
            echo '征战八方首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战八方-领取
    private function act_fight_get_reward($id)
    {
        $c['c'] = 'act_fight';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '征战八方-领取奖励' . $id . '成功</br>';
            return 1;
        } else {
            echo '征战八方-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战八方-转动
    private function act_fight_lottery($id = 1, $times = 0)
    {
        $c['c'] = 'act_fight';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '征战八方-转动成功</br>';
            if ($times - 1 > 0) {
                $this->act_fight_lottery(1, $times - 1);
            } else {
                $this->act_fight_get_achievement_info();
            }
            return 1;
        } else {
            echo '征战八方-转动失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战八方-抽奖成就
    private function act_fight_get_achievement_info()
    {
        $c['c'] = 'act_fight';
        $c['m'] = 'get_achievement_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开征战八方-抽奖成就,当前转动' . $res['num'] . '次</br>';
            foreach ($res['reward'] as $v) {
                if ($v['status'] == 1) {
                    $this->act_fight_get_achievement_reward($v['id']);
                }
            }
            return $res['num'];
        } else {
            echo '征战八方-抽奖成就打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战八方-领取成就
    private function act_fight_get_achievement_reward($id)
    {
        $c['c'] = 'act_fight';
        $c['m'] = 'get_achievement_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '征战八方-领取成就奖励' . $id . '成功</br>';
            return 1;
        } else {
            echo '征战八方-领取成就失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //助力令牌
    private function help_token_index()
    {
        $c['c'] = 'help_token';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['day_task'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->help_token_take_task_reward($v['id'], $v['t_type']);
                }
            }
            return 1;
        } else {
            echo '助力令牌打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //助力令牌-领奖
    private function help_token_take_task_reward($id, $t_type = 1)
    {
        $c['c'] = 'help_token';
        $c['m'] = 'take_task_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['t_type'] = $t_type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '助力令牌-领奖' . $id . '成功</br>';
            return 1;
        } else {
            echo '助力令牌-领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //新魔宠-首页 type 1=同名合成,2=同色合成
    private function new_magicpet_index($type = 1)
    {
        $c['c'] = 'new_magicpet';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新魔宠-首页打开成功</br>';
            // 合成
            $pids = [];
            foreach ($res['data']['pack_pet'] as $v) {
                if ($v['describe']['role'] == 4) {
                    continue;
                }
                if ($type == 1) { //同名(pid)合
                    if (isset($pids[$v['pid']])) {
                        $this->new_magicpet_compose($pids[$v['pid']], $v['id']);
                        return 1;
                    } else {
                        $pids[$v['pid']] = $v['id'];
                    }
                } else { //同色就合
                    if (isset($pids[$v['describe']['quality']])) {
                        $this->new_magicpet_compose($pids[$v['describe']['quality']], $v['id']);
                        return 1;
                    } else {
                        $pids[$v['describe']['quality']] = $v['id'];
                    }
                }
            }
            // 召唤
            if ($res['data']['free_num'] > 0) {
                $this->new_magicpet_lottery(1);
                return 1;
            }
            return 1;
        } else {
            echo '新魔宠-首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新魔宠-召唤
    private function new_magicpet_lottery($type = 1)
    {
        $c['c'] = 'new_magicpet';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新魔宠-召唤成功,获得' . $res['data']['name'] . '</br>';
            $this->new_magicpet_index();
            return 1;
        } else {
            echo '新魔宠-召唤失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新魔宠-合成
    private function new_magicpet_compose($id1, $id2)
    {
        $c['c'] = 'new_magicpet';
        $c['m'] = 'compose';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id1'] = $id1;
        $arr['id2'] = $id2;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新魔宠-合成成功,获得' . $res['data']['pet']['name'] . '</br>';
            $this->new_magicpet_index();
            return 1;
        } else {
            echo '新魔宠-合成失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新魔宠-开格子
    private function new_magicpet_add_pack()
    {
        $c['c'] = 'new_magicpet';
        $c['m'] = 'add_pack';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新魔宠-开格子成功</br>';
            $this->new_magicpet_add_pack();
            return 1;
        } else {
            echo '新魔宠-开格子失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新魔宠-上下阵
    private function new_magicpet_up_down($id, $up)
    {
        $c['c'] = 'new_magicpet';
        $c['m'] = 'up_down';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['up'] = $up;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新魔宠-' . ($up == 1 ? '上阵' : '下阵') . '成功</br>';
            $this->new_magicpet_index();
            return 1;
        } else {
            echo '新魔宠-' . ($up == 1 ? '上阵' : '下阵') . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //魔宠探险
    private function magicpet_explore_index($area_id = '')
    {
        $c['c'] = 'magicpet_explore';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $sign = 1;
            foreach ($res['explore_now'] as $v) {
                if ($v['explore_status'] == 3) {
                    echo '魔宠探险-当前正在探险,剩余时间:' . $v['remain_time'] . '</br>';
                    $sign = 0;
                } elseif ($v['explore_status'] == 2) {
                    $this->magicpet_explore_explore_receive_reward($v['area_id']);
                }
            }
            $limit_num = array_column($res['area_now'], 'now_exp');
            array_multisort($limit_num, SORT_ASC, $res['area_now']);
            foreach ($res['area_now'] as $vv) {
                if (!$this->magicpet_explore_area_reward_into($vv['area_id'])) {
                    $this->magicpet_explore_explore_start($vv['area_id']);
                }
            }
            // if($sign){
            //  $this->magicpet_explore_area_reward_into($area_id);
            // }
            return 1;
        } else {
            echo '魔宠探险打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //魔宠探险-收
    private function magicpet_explore_explore_receive_reward($area_id)
    {
        $c['c'] = 'magicpet_explore';
        $c['m'] = 'explore_receive_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['area_id'] = $area_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '魔宠探险-收奖励成功</br>';
            return 1;
        } else {
            echo '魔宠探险-收奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //魔宠探险-队伍
    private function magicpet_explore_area_reward_into($area_id)
    {
        $c['c'] = 'magicpet_explore';
        $c['m'] = 'area_reward_into';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['area_id'] = $area_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if (!$res['explore_team']) {
                $this->magicpet_explore_one_button_join($area_id);
                $this->magicpet_explore_explore_start($area_id);
            }
            return 1;
        } else {
            echo '魔宠探险-队伍打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //魔宠探险-一键加入
    private function magicpet_explore_one_button_join($area_id)
    {
        $c['c'] = 'magicpet_explore';
        $c['m'] = 'one_button_join';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['area_id'] = $area_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '魔宠探险-一键加入成功</br>';
            return 1;
        } else {
            echo '魔宠探险-队伍打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //魔宠探险-开始探险
    private function magicpet_explore_explore_start($area_id)
    {
        $c['c'] = 'magicpet_explore';
        $c['m'] = 'explore_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['area_id'] = $area_id;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '魔宠探险-开始探险</br>';
            return 1;
        } else {
            echo '魔宠探险-开始探险失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //荣耀战线
    private function glory_front_index($pk_num)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['free_times'] > 0) {
                echo '读取点将台第一个将是谋士还是猛将</br>';
                $ret = $this->muster_index();
                $group = $ret['list'][1]['type'] == 1 ? 2 : 1;
                unset($ret);
                if ($res['now_step'] == 2) {
                    $this->glory_front_pvp_span_index($group, $pk_num);
                } else {
                    $this->glory_front_pvp_index($group, $pk_num);
                }
            }
            return 1;
        } else {
            echo '荣耀战线打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //荣耀战线-加入战区
    private function glory_front_pvp_index($group, $pk_num)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'pvp_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['group'] = $group;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $area[1] = '西部战区';
            $area[2] = '东部战区';
            echo '进入' . $area[$group] . '成功</br>';
            if ($pk_num > 0) {
                $this->glory_front_pk($res['list'][0]['uid'], $res['page'], $group, $pk_num);
            }
            // foreach($res['list'] as $v){

            // }
            return 1;
        } else {
            echo '荣耀战线-加入战区失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //荣耀战线-开战
    private function glory_front_pk($touid, $page, $group, $pk_num)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;
        $arr['page'] = $page;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '攻击' . $res['battle']['right_role']['name'] . '成功,战斗结果:' . $res['info']['win'] . '</br>';
            $times = min($pk_num, $res['pk_times']) - 1;
            if ($times > 0) {
                // var_dump($pk_num,$res['pk_times'],$times);die;
                $this->glory_front_pvp_index($group, $times);
            }
            return 1;
        } else {
            echo '荣耀战线-开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //荣耀战线-跨服战区
    private function glory_front_pvp_span_index($group, $pk_num, $page = null)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'pvp_span_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['group'] = $group;
        $arr['page'] = $page;
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $area[1] = '跨服西部战区';
            $area[2] = '跨服东部战区';
            echo '进入' . $area[$group] . '第' . $res['page'] . '页成功</br>';
            if (min($pk_num, $res['own_pk_info']['pk_times']) <= 0) {
                echo '荣耀战线次数不足</br>';
                return 0;
            }
            if ($res['own_pk_info']['rank'] == 1) {
                $this->glory_front_span_pk($res['list'][1]['uid'], $res['page'], $group, $pk_num);
                return;
            }
            if (!$page && $res['page'] > 1) {
                $this->glory_front_get_spanpk_list($group, $pk_num, $res['page'] - 1);
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['is_pk'] == 1) {
                    $this->glory_front_span_pk($v['uid'], $res['page'], $group, $pk_num);
                    break;
                }
            }
            return 1;
        } else {
            echo '荣耀战线-加入战区失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //荣耀战线-跨服战区列表
    private function glory_front_get_spanpk_list($group, $pk_num, $page)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'get_spanpk_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['group'] = $group;
        $arr['page'] = $page;
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $area[1] = '跨服西部战区';
            $area[2] = '跨服东部战区';
            echo '进入' . $area[$group] . '第' . $res['page'] . '页成功</br>';
            if ($pk_num <= 0) {
                // var_dump($pk_num,$res['own_pk_info']['pk_times']);die;
                echo '荣耀战线次数不足</br>';
                return 0;
            }
            if ($res['own_pk_info']['rank'] == 1) {
                $this->glory_front_span_pk($res['list'][1]['uid'], $res['page'], $group, $pk_num);
                return;
            }
            foreach ($res['list'] as $v) {
                if ($v['is_pk'] == 1) {
                    $this->glory_front_span_pk($v['uid'], $res['page'], $group, $pk_num);
                    break;
                }
            }
            return 1;
        } else {
            echo '荣耀战线-进入战区失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //荣耀战线-跨服开战
    private function glory_front_span_pk($touid, $page, $group, $pk_num)
    {
        $c['c'] = 'glory_front';
        $c['m'] = 'span_pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;
        $arr['page'] = $page;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '攻击' . $res['battle']['right_role']['name'] . '成功,战斗结果:' . $res['info']['win'] . '</br>';
            $times = min($pk_num, $res['pk_times']) - 1;
            if ($times > 0) {
                if ($res['info']['win'] > 0 && $page > 1) {
                    $page -= 1;
                }
                // var_dump($page);die;
                $this->glory_front_get_spanpk_list($group, $times, $page);
            }
            return 1;
        } else {
            echo '荣耀战线-开战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //月卡
    private function month_fund_index()
    {
        $c['c'] = 'month_fund';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开月卡...</br>';
            foreach ($res['list'] as $v) {
                if ($v['button'] == 2) {
                    $this->month_fund_get_reward();
                    break;
                }
            }
            return 1;
        } else {
            echo '月卡打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //月卡-领取
    private function month_fund_get_reward()
    {
        $c['c'] = 'month_fund';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '月卡领取成功</br>';
            return 1;
        } else {
            echo '月卡领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //点将台
    private function muster_index()
    {
        $c['c'] = 'muster';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['page'] = 1;
        $arr['perpage'] = 999;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            return $res;
        } else {
            echo '点将台打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //暴走伐木场掠夺首页
    private function exploit_tree_loot_index()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'loot_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['loot_num'] == 0) {
                echo '伐木场掠夺次数不足</br>';
                return;
            }
            $this->exploit_tree_loot($res['loot_list'][0]['uid']);
            return 1;
        } else {
            echo '伐木场掠夺首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场掠夺动作
    private function exploit_tree_loot($touid)
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'loot';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '伐木场掠夺成功</br>';
                if ($_POST['exploit_tree_loot_index'][1]) {
                    $this->exploit_tree_loot_lottery();
                }
                $this->exploit_tree_loot_index();
            } else {
                echo '伐木场掠夺没打过</br>';
            }
            return 1;
        } else {
            echo '伐木场掠夺失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场掠夺奖励列表
    private function exploit_tree_loot_lottery()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'loot_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $num = 0;
            $str = '';
            foreach ($res['reward'] as $v) {
                if ($v['info']) {
                    $num += $v['reward_value'];
                    $str .= $v['info']['name'] . '*' . $v['reward_value'] . '|';
                }
            }
            if ($num < $_POST['exploit_tree_loot_index'][2]) {
                echo '当前掠夺奖励:' . $str . '刷新</br>';
                $this->exploit_tree_loot_lottery();
                return;
            } else {
                echo '当前掠夺奖励:' . $str . '用元宝领奖励</br>';
                $this->exploit_tree_lottery();
            }
            return 1;
        } else {
            echo '伐木场掠夺奖励打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场掠夺奖励购买
    private function exploit_tree_lottery()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '伐木场掠夺第一次奖励购买成功</br>';
            $this->exploit_tree_get_all_lottery();
            return 1;
        } else {
            echo '伐木场掠夺第一次奖励购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场掠夺奖励全部购买
    private function exploit_tree_get_all_lottery()
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'get_all_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '伐木场掠夺第二次奖励购买成功</br>';
            return 1;
        } else {
            echo '伐木场掠夺第二次奖励购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //暴走采石场掠夺首页
    private function exploit_stone_loot_index()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'loot_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['loot_num'] == 0) {
                echo '采石场掠夺次数不足</br>';
                return;
            }
            $this->exploit_stone_loot($res['loot_list'][0]['uid']);
            return 1;
        } else {
            echo '采石场掠夺首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场掠夺动作
    private function exploit_stone_loot($touid)
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'loot';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '采石场掠夺成功</br>';
                if ($_POST['exploit_tree_loot_index'][1]) {
                    $this->exploit_stone_loot_lottery();
                }
                $this->exploit_stone_loot_index();
            } else {
                echo '采石场掠夺没打过</br>';
            }
            return 1;
        } else {
            echo '采石场掠夺失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场掠夺奖励列表
    private function exploit_stone_loot_lottery()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'loot_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $num = 0;
            $str = '';
            foreach ($res['reward'] as $v) {
                if ($v['info']) {
                    $num += $v['reward_value'];
                    $str .= $v['info']['name'] . '*' . $v['reward_value'] . '|';
                }
            }
            if ($num < $_POST['exploit_tree_loot_index'][2]) {
                echo '当前掠夺奖励:' . $str . '刷新</br>';
                $this->exploit_stone_loot_lottery();
                return;
            } else {
                echo '当前掠夺奖励:' . $str . '用元宝领奖励</br>';
                $this->exploit_stone_lottery();
            }
            return 1;
        } else {
            echo '采石场掠夺失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场掠夺奖励购买
    private function exploit_stone_lottery()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '采石场掠夺第一次奖励购买成功</br>';
            $this->exploit_stone_get_all_lottery();
            return 1;
        } else {
            echo '采石场掠夺第一次奖励购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场掠夺奖励全部购买
    private function exploit_stone_get_all_lottery()
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'get_all_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '采石场掠夺第二次奖励购买成功</br>';
            return 1;
        } else {
            echo '采石场掠夺第二次奖励购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场缉拿列表
    private function exploit_tree_rank_index($num)
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'rank_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['rank'] as $v) {
                if ($v['rank'] == $num) {
                    $this->exploit_tree_arrest($v['uid'], $num);
                    return;
                }
            }
            return 1;
        } else {
            echo '伐木场缉拿列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走伐木场缉拿动作
    private function exploit_tree_arrest($touid, $num)
    {
        $c['c'] = 'exploit_tree';
        $c['m'] = 'arrest';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '伐木场缉拿成功</br>';
                $this->exploit_tree_rank_index($num);
            } else {
                echo '伐木场缉拿没打过</br>';
            }
            return 1;
        } else {
            echo '伐木场缉拿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场缉拿列表
    private function exploit_stone_rank_index($num)
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'rank_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['rank'] as $v) {
                if ($v['rank'] == $num) {
                    $this->exploit_stone_arrest($v['uid'], $num);
                    return;
                }
            }
            return 1;
        } else {
            echo '采石场缉拿列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //暴走采石场缉拿动作
    private function exploit_stone_arrest($touid, $num)
    {
        $c['c'] = 'exploit_stone';
        $c['m'] = 'arrest';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['touid'] = $touid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '采石场缉拿成功</br>';
                $this->exploit_stone_rank_index($num);
            } else {
                echo '采石场缉拿没打过</br>';
            }
            return 1;
        } else {
            echo '采石场缉拿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉楼首页
    private function jade_tower_index($floor, $refine_id, $nickname, $password = '', $creat = 0, $page = 1, $matrix)
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['page'] = $page;
        $c['limit_type'] = 0;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $user = explode(',', array_values($this->user_arr)[0]);

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if (!$res['join_room']) {
                if ($creat) {
                    echo '准备创建玉楼队伍</br>';
                    $this->jade_tower_create_room($floor, $password);
                } else {
                    if (!$res['list']) {
                        echo '当前页没有玉楼队伍</br>';
                    }
                    echo '查找要加入的玉楼队伍</br>';
                    $sign = 0;
                    foreach ($res['list'] as $v) {
                        if ($v['nickname'] == $nickname) {
                            $this->jade_tower_join_room($v['id'], $password);
                            $sign = 1;
                            break;
                        }
                    }
                    if (!$sign) {
                        echo '当前页没有找到队伍,查看下一页</br>';
                        $this->jade_tower_index($floor, $refine_id, $nickname, $password, $creat, $page + 1, $matrix);
                    }
                }
                return;
            }
            if ($res['join_room']['status'] == 3) {
                if (!$_POST[$user[0] . (int)$user[2]]['now_matrix']) {
                    $_POST[$user[0] . (int)$user[2]]['now_matrix'] = $this->matrix_case_index();
                }
                echo '玉楼已打完,准备炼化</br>';
                if ($matrix) {
                    $use = explode(',', $matrix);
                    $ret = $this->matrix_use_case($use[0], $use[1]);
                }
                $this->jade_tower_fight_refine($refine_id);
                if ($matrix) {
                    echo '切回阵法</br>';
                    $this->matrix_use_case($_POST[$user[0] . (int)$user[2]]['now_matrix'][0], $_POST[$user[0] . (int)$user[2]]['now_matrix'][1]);
                }
                return;
            }
            if ($res['join_room']['member1_ready'] == 1 && $res['join_room']['member2_ready'] == 1) {
                echo '玉楼人已到齐,都已准备,可以开怪</br>';
                if ($matrix) {
                    $use = explode(',', $matrix);
                    $ret = $this->matrix_use_case($use[0], $use[1]);
                    if ($ret === 0) {
                        return;
                    }
                }
                $this->jade_tower_start();
                $this->jade_tower_fight();
                return;
            } else {
                echo '玉楼人不齐或者有人没准备</br>';
                return;
            }
            return 1;
        } else {
            echo '玉楼首页打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //加入玉楼队伍
    private function jade_tower_join_room($room_id, $password = '')
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'join_room';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['room_id'] = $room_id;
        $arr['password'] = $password;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '加入玉楼队伍成功</br>';
            $this->jade_tower_ready();
            return 1;
        } else {
            echo '加入玉楼队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //创建玉楼队伍
    private function jade_tower_create_room($floor, $password = '')
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'create_room';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['floor'] = $floor;
        $arr['password'] = $password;
        $arr['name'] = '自动化房间';
        $arr['limit_type'] = 0;
        $arr['min_level'] = 0;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '创建玉楼队伍成功,密码:' . $password . '</br>';
            return 1;
        } else {
            echo '创建玉楼队伍失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉楼-准备
    private function jade_tower_ready()
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'ready';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '玉楼-准备</br>';
            return 1;
        } else {
            echo '玉楼-准备失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉楼-开始
    private function jade_tower_start()
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '玉楼-开始</br>';
            return 1;
        } else {
            echo '玉楼-开始失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉楼-开战继续
    private function jade_tower_fight()
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'fight';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '玉楼-攻击成功...</br>';
                $this->jade_tower_fight();
            } else {
                echo '玉楼-翻车...自己上号吧...</br>';
            }
            return 1;
        } else {
            echo '玉楼-攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉楼-炼化
    private function jade_tower_fight_refine($refine_id)
    {
        $c['c'] = 'jade_tower';
        $c['m'] = 'fight_refine';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['refine_id'] = $refine_id;

        $res = $this->post($url, $arr, [], 3000000);
        if ($res['status'] == 1) {
            echo '玉楼-炼化成功...缓冲3秒</br>';
            $this->jade_tower_fight_refine($refine_id);
            return 1;
        } else {
            echo '玉楼-炼化失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //随机获取一条身份证信息
    private function get_one_card()
    {
        $cards = explode("\n", file_get_contents('./card.txt'));
        $card = explode("----", $cards[rand(0, count($cards))]);
        unset($cards);
        return $card;
    }

    //打开设置
    private function activationcode_index($username)
    {
        $c['c'] = 'activationcode';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['username'] = $username;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开设置<br>';
            if ($res['identity'] == 1) {
                echo '该账号已实名<br>';
                return 0;
            }
            return 1;
        } else {
            echo '打开设置失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //绑定身份证
    public function activationcode_identification($username)
    {
        $ret = $this->activationcode_index($username);
        if ($ret && $ret['identity'] == 0) {
            $c['c'] = 'activationcode';
            $c['m'] = 'identification';
            $c['token_uid'] = $this->token_uid;
            $c['token'] = $this->token;
            $url = $this->transformation_url($c, $this->token);
            $card = $this->get_one_card();
            $arr['token'] = $this->token;
            $arr['username'] = $username;
            $arr['name'] = trim($card[0]);
            $arr['id_number'] = trim($card[1]);

            $res = $this->post($url, $arr);
            if ($res['status'] == 1) {
                echo '绑定身份证成功' . $card[0] . ':' . $card[1] . '<br>';
                return 1;
            } else {
                echo '绑定身份证' . $card[0] . ':' . $card[1] . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . ',重试一次...</br>';
                $this->activationcode_identification($username);
                return 0;
            }
        } else {
            return 1;
        }
    }

    //提炼星魂
    private function star_refining($id, $refine_type, $num)
    {
        $c['c'] = 'star';
        $c['m'] = 'refining';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['refine_type'] = $refine_type;
        $arr['num'] = 1000;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '提炼星魂成功<br>';
            if ($num > 1) {
                $num -= 1;
                $this->star_refining($id, $refine_type, $num);
            }
            return 1;
        } else {
            echo '提炼星魂失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //购物盛宴-消费3w
    private function shopping_feast_buy_mj($buy_list = 22, $num_list = 80)
    {
        $c['c'] = 'shopping_feast';
        $c['m'] = 'buy_mj';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['buy_list'] = $buy_list;
        $arr['num_list'] = $num_list;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '购物盛宴-消费3w成功<br>';
            return 1;
        } else {
            echo '购物盛宴-消费3w失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //魔宠-消费3w
    private function magicpet_call_action($type = 2, $pid = 4)
    {
        $c['c'] = 'magicpet_call';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['pid'] = $pid;

        for ($i = 0; $i < 9; $i++) {
            $res = $this->post($url, $arr, [], 0);
        }
        if ($res['status'] == 1) {
            echo '购物盛宴-消费3w成功<br>';
            return 1;
        } else {
            echo '购物盛宴-消费3w失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //科技-激活
    private function war_college_use_buff()
    {
        $this->country_taxes_shop_buy();
        $c['c'] = 'war_college';
        $c['m'] = 'use_buff';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '科技-激活成功<br>';
            return 1;
        } else {
            echo '科技-激活失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //国家商店购买
    // private function country_taxes_shop_buy($id=1){
    //  $c['c'] = 'country_taxes_shop';
    //  $c['m'] = 'buy';
    //  $c['token_uid'] = $this->token_uid;
    //  $c['token'] = $this->token;
    //  $url = $this->transformation_url($c,$this->token);
    //  $arr['token'] = $this->token;
    //  $arr['id'] = $id;

    //  $res = $this->post($url,$arr,[],0);
    //  if($res['status'] == 1){
    //      echo '国家商店购买成功<br>';
    //      return 1;
    //  }else{
    //      echo '国家商店购买失败:'.$res['msg'].',状态码:'.$res['status'].'</br>';
    //      return 0;
    //  }
    // }
    //蓝换突飞
    private function tavern_buy2()
    {
        $c['c'] = 'tavern';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['generalid'] = 1000;
        $arr['num'] = 100;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '1 ';
            $this->tavern_buy2();
            return 1;
        } else {
            echo '蓝换突飞失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //新年签到
    private function newyear_sign_sign()
    {
        $c['c'] = 'newyear_sign';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '新年签到成功</br>';
            return 1;
        } else {
            echo '新年签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //打开神铸界面
    private function equip_forge_godcast_index($gname, $name, $type = 0, $num = 1, $max = 3500, $free = 1)
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'godcast_index';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开神铸界面成功</br>';
            if ($free && !$res['is_free']) {
                echo '今日免费次数已用尽</br>';
                return 1;
            }
            //只使用免费次数
            foreach ($res['equip_info'] as $v) {
                if ($v['gname'] == $gname && $v['name'] == $name) {
                    $this->equip_forge_godcast_action($v['id'], $type, $num, $max, $free);
                    break;
                }
            }
            echo '跑完或者将领的装备没找到</br>';
            return 1;
        } else {
            echo '打开神铸界面失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神铸动作
    private function equip_forge_godcast_action($id, $type = 0, $num = 1, $max, $free = 0)
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'godcast_action';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['type'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $ret = '';
            $all_num = 0;
            for ($i = 1; $i <= 5; $i++) {
                if ($res['info']['new_jiangcheng' . $i]) {
                    $ret .= $res['info']['new_num' . $i] . ',';
                    $all_num += $res['info']['new_jiangcheng' . $i];
                }
            }
            if ($res['info']['new_jiangcheng' . $num]) {
                //如果有这条代表只看一条
                if ($res['info']['new_jiangcheng' . $num] > 0) {
                    //替换
                    $msg = '替换';
                } else {
                    //放弃
                    $msg = 'pass';
                }
            } else {
                // 代表看总神铸数
                if ($all_num > 0) {
                    $msg = '替换';
                } else {
                    $msg = 'pass';
                }
            }
            echo '神铸等级结果:' . $ret . ',当前' . $res['new'] . '级;' . $msg . '</br>';
            $again = $res['new'] < $max  && $free == 0 ? 1 : 0;
            if ($res['info']['new_is_max' . $num]) {
                echo '单条已满</br>';
                $again = 0;
            }
            if ($msg == '替换') {
                $this->equip_forge_save($id, $type, $num, $max, $again);
            } elseif ($msg == 'pass') {
                $this->equip_forge_giveup($id, $type, $num, $max, $again);
            }
            return 1;
        } else {
            echo '神铸动作失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神铸-维持
    private function equip_forge_giveup($id, $type, $num, $max, $again)
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'giveup';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($again) {
                $this->equip_forge_godcast_action($id, $type, $num, $max);
            }
            return 1;
        } else {
            echo '神铸-维持失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神铸-替换
    private function equip_forge_save($id, $type, $num, $max, $again)
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'save';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($again) {
                $this->equip_forge_godcast_action($id, $type, $num, $max);
            }
            return 1;
        } else {
            echo '神铸-替换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //名将成就列表
    private function general_book_get_achievement_list()
    {
        $c['c'] = 'general_book';
        $c['m'] = 'get_achievement_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开名将成就列表</br>';
            foreach ($res['achievement'] as $v) {
                if (!$v['ismax']) {
                    if (!$this->general_book_levelup($v['id'], $v['name'])) {
                        break;
                    }
                }
            }
            return 1;
        } else {
            echo '名将成就列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //名将成就升级
    private function general_book_levelup($id, $name)
    {
        $c['c'] = 'general_book';
        $c['m'] = 'levelup';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo $name . '成就升级成功</br>';
            if (!$res['ismax']) {
                $this->general_book_levelup($id, $name);
            }
            return 1;
        } else {
            echo $name . '成就升级失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //建业募兵
    private function eight_year_prey_index($buy_arr, $sell)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'prey_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['zoo_list'] as $k => $v) {
                // if($v['quality'] == 4 || $v['id'] == 5){
                if (in_array($v['id'], $buy_arr)) {
                    if ($this->eight_year_prey($k, $buy_arr, $sell)) {
                        $this->eight_year_prey_index($buy_arr, $sell);
                    }
                    return;
                }
            }
            $this->eight_year_refresh_prey_zoo($buy_arr, $sell);
            return 1;
        } else {
            echo '建业募兵打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //建业募兵-招募
    private function eight_year_prey($site, $buy_arr, $sell)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'prey';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['site'] = $site;

        $res = $this->post($url, $arr, [], 400000);
        if ($res['status'] == 1) {
            echo '建业募兵招募成功</br>';
            return 1;
        } else {
            echo '建业募兵招募失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == -6) {
                $this->eight_year_sell_index(1, $buy_arr, $sell);
            }
            if ($res['status'] == -7) {
                return $this->eight_year_prey($site, $buy_arr, $sell);
            }
            return 0;
        }
    }
    //建业募兵-刷新
    private function eight_year_refresh_prey_zoo($buy_arr, $sell)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'refresh_prey_zoo';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '建业募兵刷新成功</br>';
            $this->eight_year_prey_index($buy_arr, $sell);
            return 1;
        } else {
            echo '建业募兵刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //建业募兵-售卖列表
    private function eight_year_sell_index($quality = 1, $buy_arr, $sell, $sell_all = false)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'sell_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['quality'] = $quality;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '建业募兵售卖列表' . $quality . '</br>';
            if ($sell_all) {
                foreach ($res['user_zoo'] as $v) {
                    $this->eight_year_sell_zoo($v['site']);
                }
                if ($quality < 4) {
                    $quality += 1;
                    $this->eight_year_sell_index($quality, $buy_arr, $sell, true);
                    return 1;
                }
                return 1;
            }
            foreach ($res['user_zoo'] as $v) {
                if ($v['star'] == 3) {
                    $ret = $this->eight_year_sell_zoo($v['site']);
                }
            }
            if (!$ret) {
                // 没有3星可出售 只能出售1个1星
                foreach ($res['user_zoo'] as $v) {
                    if ($v['star'] == 1 && $v['zoo_id'] == $sell) {
                        $ret2 = $this->eight_year_sell_zoo($v['site']);
                        $this->eight_year_prey_index($buy_arr, $sell);
                        return 1;
                    }
                }
                // 1星也没有就下一页
                if ($quality < 4) {
                    $quality += 1;
                    $this->eight_year_sell_index($quality, $buy_arr, $sell);
                }
                return 0;
            }
            $this->eight_year_prey_index($buy_arr, $sell);
            return 1;
        } else {
            echo '建业募兵售卖列表打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //建业募兵-售卖动作
    private function eight_year_sell_zoo($site)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'sell_zoo';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['site'] = $site;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '建业募兵售卖成功</br>';
            return 1;
        } else {
            echo '建业募兵售卖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-长安圣谕
    private function eight_year_task_index()
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'task_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-长安圣谕打开成功</br>';
            if ($res['now_task_infous']['is_take'] == 1) {
                $this->eight_year_take_task_reward($res['now_task_infous']['id']);
            }
            return 1;
        } else {
            echo '八周年庆-长安圣谕打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-长安圣谕-领取
    private function eight_year_take_task_reward($id)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'take_task_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-长安圣谕-领取' . $id . '成功</br>';
            return 1;
        } else {
            echo '八周年庆-长安圣谕-领取' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-邺城求贤
    private function eight_year_consumption_index($num)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'consumption_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-邺城求贤打开成功</br>';
            foreach ($res['consumption_reward'] as $k => $v) {
                if ($k == $num && $v['is_take'] == 1) {
                    $this->eight_year_take_consumption($v['id']);
                    $this->eight_year_consumption_index($num);
                    return 1;
                }
            }
            return 1;
        } else {
            echo '八周年庆-邺城求贤打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-邺城求贤-领取
    private function eight_year_take_consumption($id)
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'take_consumption';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-邺城求贤-领取' . $id . '成功</br>';
            return 1;
        } else {
            echo '八周年庆-邺城求贤-领取' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-汝南补贴-领取
    private function eight_year_onekey_rebate()
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'onekey_rebate';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-汝南补贴-领取成功</br>';
            return 1;
        } else {
            echo '八周年庆-汝南补贴-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-许昌商会
    private function eight_year_shop_index()
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-许昌商会,当前类型' . $res['list'][0]['type'] . '</br>';
            if ($res['list'][0]['type'] == 8) {
                foreach ($res['list'] as $v) {
                    if (in_array($v['reward_info']['name'], ['幽魂流星锤', '流光星陨扇', '星云迷踪甲', '寂灭长歌袍', '紫韵天心链'])) {
                        if ($v['discount'] < 8) {
                            echo '已经刷出小于8折暗金装备</br>';
                            return 1;
                        } else {
                            echo $v['discount'] . '折' . $v['reward_info']['name'] . '</br>';
                        }
                    }
                }
            }
            $this->eight_year_refresh_shop();
            return 1;
        } else {
            echo '八周年庆-许昌商会打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //八周年庆-许昌商会-刷新
    private function eight_year_refresh_shop()
    {
        $c['c'] = 'eight_year';
        $c['m'] = 'refresh_shop';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '八周年庆-许昌商会-刷新成功</br>';
            $this->eight_year_shop_index();
            return 1;
        } else {
            echo '八周年庆-许昌商会-刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //结义马场
    private function sworn_capture()
    {
        $c['c'] = 'sworn';
        $c['m'] = 'capture';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '收菜结义马场</br>';
            return 1;
        } else {
            echo '结义马场打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //结义农田
    private function sworn_crops_info()
    {
        $c['c'] = 'sworn';
        $c['m'] = 'crops_info';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['list'][0]['reap_cd'] > 0) {
                return 0;
            }
            $this->sworn_reap();
            $this->sworn_plant();
            return 1;
        } else {
            echo '结义农田收失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //收结义农田
    private function sworn_reap()
    {
        $c['c'] = 'sworn';
        $c['m'] = 'reap';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = 0;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '收菜结义农田</br>';
            return 1;
        } else {
            echo '结义农田收失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //种结义农田
    private function sworn_plant()
    {
        $c['c'] = 'sworn';
        $c['m'] = 'plant';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = 0;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '种菜结义农田</br>';
            return 1;
        } else {
            echo '结义农田种失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //结义打铁
    private function sworn_smelt()
    {
        $c['c'] = 'sworn';
        $c['m'] = 'smelt';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '收菜结义打铁</br>';
            return 1;
        } else {
            echo '结义打铁失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //结义卖果
    private function sworn_sell_index($ids)
    {
        $c['c'] = 'sworn';
        $c['m'] = 'sell_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开结义卖果</br>';
            $redeem = $res['redeem'];
            foreach ($res['fruit_list'] as $v) {
                if ($v['owns'] > 0) {
                    $redeem = $this->sworn_sell($v['id'], $v['owns']);
                }
            }
            $ids = explode(' ', $ids);
            foreach ($res['exchange_list'] as $v) {
                if (!in_array($v['id'], $ids)) {
                    continue;
                }
                $num = $v['limit_time'] - $v['buy_time'];
                if ($num >= 1) {
                    for ($i = 0; $i < $num; $i++) {
                        if ($redeem > $v['redeem']) {
                            $redeem = $this->sworn_exchange($v['id']);
                        } else {
                            echo '积分不足</br>';
                            break 2;
                        }
                    }
                }
            }
            return 1;
        } else {
            echo '打开结义卖果失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //结义卖果动作
    private function sworn_sell($id, $number)
    {
        $c['c'] = 'sworn';
        $c['m'] = 'sell';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['number'] = $number;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '结义卖果成功,当前积分' . $res['redeem'] . '</br>';
            return $res['redeem'];
        } else {
            echo '结义卖果失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //结义卖果兑换物资
    private function sworn_exchange($id)
    {
        $c['c'] = 'sworn';
        $c['m'] = 'exchange';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '结义卖果兑换物资成功,剩余积分' . $res['redeem'] . '</br>';
            return $res['redeem'];
        } else {
            echo '结义卖果兑换物资失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //势力商店
    private function territory_shop($ids)
    {
        $c['c'] = 'territory';
        $c['m'] = 'shop';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '势力商店打开成功</br>';
            if ($res['force_point'] < 100) {
                return 0;
            }
            $ids = explode(' ', $ids);
            foreach ($res['list'] as $v) {
                if ($v['number'] < 0) {
                    continue;
                }
                if (in_array($v['id'], $ids)) {
                    $this->territory_buy($v['id']);
                }
            }
            return 1;
        } else {
            echo '势力商店打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //势力商店兑换物资
    private function territory_buy($goods_id)
    {
        $c['c'] = 'territory';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['goods_id'] = $goods_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '势力商店兑换物资成功</br>';
            return 1;
        } else {
            echo '势力商店兑换物资失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //购物庆典-代币转盘
    private function act_doubleeleven_lottery_ten($times)
    {
        $c['c'] = 'act_doubleeleven';
        $c['m'] = 'lottery_ten';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $a = $b = 0;
            foreach ($res['reward'] as $v) {
                if ($v['type'] == 43) {
                    $a += $v['value'];
                }
                if ($v['type'] == 44) {
                    $b += $v['value'];
                }
            }
            echo "购物庆典-代币转盘转动,id:43(符)获得{$a}个,id:44(熊)获得{$b}个</br>";
            if ($times > 1) {
                $this->act_doubleeleven_lottery_ten($times - 1);
            }
            return 1;
        } else {
            echo '购物庆典-代币转盘失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //疆域纷争-势力列表
    private function territory_force_list($name)
    {
        $c['c'] = 'territory';
        $c['m'] = 'force_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo "打开疆域纷争-势力列表</br>";
            $is_find = 0;
            foreach ($res['list'] as $v) {
                if ($name == $v['name']) {
                    $this->territory_force_apply($v['id']);
                    $is_find = 1;
                    break;
                }
            }
            if (!$is_find) {
                echo "找不到势力'{$name}'</br>";
            }
            return 1;
        } else {
            echo '打开疆域纷争-势力列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //疆域纷争-申请势力
    private function territory_force_apply($force_id)
    {
        $c['c'] = 'territory';
        $c['m'] = 'force_apply';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['force_id'] = $force_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '疆域纷争-申请势力成功</br>';
            return 1;
        } else {
            echo '疆域纷争-申请势力失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //经脉首页
    private function drug_index($name, $need_level = 6, $is_gold = 0)
    {
        $c['c'] = 'drug';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开经脉系统成功,查找将领' . $name . '</br>';
            $dan = [
                '38' => $res['xisui_dan'],
                '39' => $res['juyuan_dan'],
                '40' => $res['butian_dan'],
                '82' => $res['jinsui_dan'],
            ];
            foreach ($res['list'] as $v) {
                if ($v['name'] == $name) {
                    echo $name . '当前' . $v['info']['now_level_name']['name'] . $v['info']['now_meridian_name'] . '</br>';
                    if ($need_level > $v['info']['level']) {
                        for ($i = 0; $i <= 4; $i++) {
                            $need[$v['info']['now_point_costtype' . $i]] = $v['info']['now_point_costnum' . $i];
                        }
                        foreach ($need as $kk => $vv) {
                            if ($kk != 0 && $dan[$kk] < $vv) {
                                echo '丹药' . $kk . '不足,前去购买</br>';
                                if (!$this->drug_shop_index($kk, $vv)) {
                                    return 0;
                                }
                            }
                        }
                        $type = 'undefined';
                        if ($is_gold && $v['info']['level'] > 3 && $v['info']['meridian'] == 8 && $v['info']['point'] > 5) {
                            echo '大于3重的阳跷脉后三下用元宝</br>';
                            $type = 1;
                        }
                        $this->drug_action($v['id'], $v['info']['level'], $v['info']['meridian'], $v['info']['point'], $type, $need_level, $is_gold);
                    }
                    break;
                }
            }
            return 1;
        } else {
            echo '打开经脉系统失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //经脉-冲穴
    private function drug_action($gid, $level, $meridian, $point, $type, $need_level, $is_gold = 0)
    {
        $c['c'] = 'drug';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;
        $arr['level'] = $level;
        $arr['meridian'] = $meridian;
        $arr['point'] = $point;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['is_success'] == 1) {
                echo '经脉-冲穴成功,当前' . $res['list']['info']['now_level_name']['name'] . $res['list']['info']['now_meridian_name'] . $res['list']['info']['now_point_name'] . '</br>';
            } else {
                echo '经脉-冲穴失败</br>';
            }
            $dan = [
                '38' => $res['xisui_dan'],
                '39' => $res['juyuan_dan'],
                '40' => $res['butian_dan'],
                '82' => $res['jinsui_dan'],
            ];
            for ($i = 0; $i <= 4; $i++) {
                $need[$res['list']['info']['now_point_costtype' . $i]] = $res['list']['info']['now_point_costnum' . $i];
            }
            foreach ($need as $k => $v) {
                if ($k != 0 && $dan[$k] < $v) {
                    echo '丹药' . $k . '不足,前去购买</br>';
                    if (!$this->drug_shop_index($k, $v)) {
                        return 0;
                    }
                }
            }
            // 继续冲穴
            $type = 'undefined';
            if ($is_gold && $res['list']['info']['level'] > 3 && $res['list']['info']['meridian'] == 8 && $res['list']['info']['point'] > 5) {
                echo '大于3重的阳跷脉后三下用元宝</br>';
                $type = 1;
            }
            if ($need_level > $res['list']['info']['level']) {
                $this->drug_action($gid, $res['list']['info']['level'], $res['list']['info']['meridian'], $res['list']['info']['point'], $type, $need_level);
            }
            return 1;
        } else {
            echo '经脉-冲穴失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //丹药商城
    private function drug_shop_index($goods_type, $num)
    {
        $c['c'] = 'drug';
        $c['m'] = 'shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '丹药商城打开成功</br>';
            if ($goods_type == 38) {
                $name = 'xisui_dan';
            } elseif ($goods_type == 39) {
                $name = 'juyuan_dan';
            } elseif ($goods_type == 82) {
                $name = 'jinsui_dan';
            } elseif ($goods_type == 40) {
                $name = 'butian_dan';
            } else {
                return 0;
            }
            foreach ($res['list'] as $v) {
                if ($v['sub_type'] == 37 && $v['goods_type'] == $goods_type) {
                    $this->drug_reward_index($v['id'], $num, $name);
                    return 1;
                }
            }
            //没return说明当前页没有,需要刷新
            $this->drug_refresh();
            sleep(2);
            $this->drug_shop_index($goods_type, $num);
            return 1;
        } else {
            echo '丹药商城打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //丹药商城-购买
    private function drug_reward_index($id, $num, $name)
    {
        $c['c'] = 'drug';
        $c['m'] = 'reward_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '丹药商城购买成功,当前' . $name . '数量:' . $res[$name] . '.剩余桃子:' . $res['dan_essence'] . '</br>';
            // var_dump($res[$name] , $num);die;
            if ($res[$name] < $num) {
                $this->drug_reward_index($id, $num, $name);
            }
            return 1;
        } else {
            echo '丹药商城购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //丹药商城-刷新
    private function drug_refresh()
    {
        $c['c'] = 'drug';
        $c['m'] = 'refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '丹药商城刷新成功</br>';
            return $res['list'];
        } else {
            echo '丹药商城刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //觉醒商店 $is_64 是否只买觉醒石
    private function awaken_shop($is_64 = true)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'shop';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒商店-打开成功</br>';
            foreach ($res['list'] as $v) {
                if ($v['coin_type'] == 65 && $v['status'] == 1) { //只买元神为代币的道具
                    if ((!$is_64 && $v['is_need'] == 1) || $v['reward_type'] == 64) {
                        if (!$this->awaken_shop_buy($v['id'])) {
                            return false;
                        }
                    }
                }
            }
            if ($is_64) {
                $this->awaken_shop(true);
            } else {
                $this->awaken_index();
            }
            // if ($res['remain_freetimes'] > 0) {
            //     $this->awaken_refresh();
            // }
            return 1;
        } else {
            echo '觉醒商店-打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒
    private function awaken_index()
    {
        $c['c'] = 'awaken';
        $c['m'] = 'index';
        $c['v'] = 0;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒首页-打开成功</br>';
            $quality = 0; //最高进阶等级
            $index = 0; //list下标
            // 获取最高进阶将领
            foreach ($res['list'] as $k => $v) {
                if ($v['quality'] > $quality) {
                    $quality = $v['quality'];
                    $index = $k;
                }
            }
            echo '觉醒目标设置为当前进阶最高将领-' . $res['list'][$index]['name'] . '</br>';
            $this->awaken_get_general_info($res['list'][$index]['id']);
            return 1;
        } else {
            echo '觉醒首页-打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒-查看将领信息
    private function awaken_get_general_info($gid)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'get_general_info';
        $c['v'] = 0;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $this->awaken_shop_geeral_tab($gid);
            echo '觉醒-查看将领信息-打开成功</br>';
            $this->awaken_all_equip($gid);
            foreach ($res['equip'] as $v) {
                // echo '<pre>';
                // var_dump($v['id']);
                // echo '</pre>';
                if ($v['status'] != 1) {
                    echo '缺少道具-' . $v['id']['name'] . ',去商店刷</br>';
                    $this->awaken_shop(false);
                    return;
                }
            }
            $this->awaken_awaken_action($gid);
            return 1;
        } else {
            echo '觉醒-查看将领信息-打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒动作
    private function awaken_awaken_action($gid)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'awaken_action';
        $c['v'] = 0;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒-升级成功</br>';
            $this->awaken_index();
            return 1;
        } else {
            if ($res['status'] == -5) {
                //觉醒石不够继续买
                $this->awaken_shop(false);
                return 0;
            }
            echo '觉醒-升级失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒-一键装备
    private function awaken_all_equip($gid)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'all_equip';
        $c['v'] = 0;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒-一键装备成功</br>';
            return 1;
        } else {
            if ($res['status'] != -4) {
                echo '觉醒-一键装备失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            }
            return 0;
        }
    }
    //觉醒商店-将领标记
    private function awaken_shop_geeral_tab($gid)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'shop_geeral_tab';
        $c['v'] = 0;
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['gid'] = $gid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒商店-将领标记成功</br>';
            return 1;
        } else {
            echo '觉醒商店-将领标记失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒商店-购买
    private function awaken_shop_buy($id)
    {
        $c['c'] = 'awaken';
        $c['m'] = 'shop_buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒商店-购买成功</br>';
            return 1;
        } else {
            echo '觉醒商店-购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //觉醒商店-刷新
    private function awaken_refresh()
    {
        $c['c'] = 'awaken';
        $c['m'] = 'refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '觉醒商店-刷新成功</br>';
            foreach ($res['list'] as $v) {
                if ($v['reward_type'] == 64 && $v['coin_type'] == 65 && $v['status'] == 1) {
                    $this->awaken_shop_buy($v['id']);
                }
            }
            if ($res['remain_freetimes'] > 0) {
                $this->awaken_refresh();
            }
            return 1;
        } else {
            echo '觉醒商店-刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }


    //十年庆典
    private function tenyear_celebration_sign_index()
    {
        $c['c'] = 'tenyear_celebration';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开十年庆典</br>';
            foreach ($res['every_day_reward_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->tenyear_celebration_sign($v['day']);
                    $this->tenyear_celebration_sign_index();
                    return;
                }
            }
            foreach ($res['accumulative_total_reward_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->tenyear_celebration_receive_total_sign_reward($v['day']);
                }
            }
            return 1;
        } else {
            echo '打开十年庆典失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //十年庆典-签到
    private function tenyear_celebration_sign($day)
    {
        $c['c'] = 'tenyear_celebration';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['day'] = $day;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十年庆典-第' . $day . '天签到成功</br>';
            return 1;
        } else {
            echo '十年庆典-第' . $day . '天签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //十年庆典-累签奖励
    private function tenyear_celebration_receive_total_sign_reward($day)
    {
        $c['c'] = 'tenyear_celebration';
        $c['m'] = 'receive_total_sign_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['day'] = $day;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十年庆典-累签' . $day . '天累签奖励领取成功</br>';
            return 1;
        } else {
            echo '十年庆典-累签' . $day . '天累签奖励领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扔雪球
    private function snow_ball_index()
    {
        $c['c'] = 'snow_ball';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开扔雪球</br>';
            if ($res['ball_info'][0]['day_num'] > $res['user_info']['ball_num_1']) {
                for ($i = 0; $i < $res['ball_info'][0]['day_num'] - $res['user_info']['ball_num_1']; $i++) {
                    $this->snow_ball_ball();
                }
                $this->snow_ball_take_stage_reward(1);
                $this->snow_ball_take_stage_reward(2);
                $this->snow_ball_take_stage_reward(3);
                $this->snow_ball_pack();
            }
            return 1;
        } else {
            echo '打开扔雪球失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扔雪球-动作
    private function snow_ball_ball()
    {
        $c['c'] = 'snow_ball';
        $c['m'] = 'ball';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['ball'] = 1;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '点击第一个扔雪球</br>';
            return 1;
        } else {
            echo '点击第一个扔雪球失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扔雪球-领奖
    private function snow_ball_take_stage_reward($stage)
    {
        $c['c'] = 'snow_ball';
        $c['m'] = 'take_stage_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['stage'] = $stage;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '扔雪球-领奖成功</br>';
            return 1;
        } else {
            echo '扔雪球-领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扔雪球-背包奖励
    private function snow_ball_pack()
    {
        $c['c'] = 'snow_ball';
        $c['m'] = 'pack';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '扔雪球-打开背包</br>';
            foreach ($res['own_box'] as $v) {
                $this->snow_ball_open_box($v['rewardInfo']['id']);
            }
            return 1;
        } else {
            echo '扔雪球-打开背包失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //扔雪球-开盒子
    private function snow_ball_open_box($box_id)
    {
        $c['c'] = 'snow_ball';
        $c['m'] = 'open_box';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['box_id'] = $box_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '扔雪球-开背包盒子成功</br>';
            return 1;
        } else {
            echo '扔雪球-开背包盒子失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //征战东瀛
    private function japan_index()
    {
        $c['c'] = 'japan';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开征战东瀛</br>';
            foreach ($res['progress'] as $k => $v) {
                if (strstr($k, 'city') && $v < 100) {
                    $this->japan_city(str_replace('city', '', $k));
                    break;
                }
            }
            return 1;
        } else {
            echo '打开征战东瀛失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战东瀛-攻击
    private function japan_pk($cityid, $bossid)
    {
        $c['c'] = 'japan';
        $c['m'] = 'pk';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['cityid'] = $cityid;
        $arr['bossid'] = $bossid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '征战东瀛-攻击</br>';
            $this->japan_index();
            return 1;
        } else {
            echo '征战东瀛-攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //征战东瀛-打开城池
    private function japan_city($cityid)
    {
        $c['c'] = 'japan';
        $c['m'] = 'city';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['cityid'] = $cityid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '征战东瀛-打开城池</br>';
            foreach ($res['instance_progress'] as $k => $v) {
                if (strstr($k, 'pro') && $v > 0) {
                    $this->japan_pk($cityid, str_replace('pro', '', $k));
                    break;
                }
            }
            return 1;
        } else {
            echo '征战东瀛-打开城池失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //初春青团
    private function spring_outing_mine($p = 1, $is_special = false, $class = 0, $row = 0, $type = 1)
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'mine';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;
        echo '初春青团打开第' . $p . '页</br>';
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['log']['site'] > 0) {
                if ($this->spring_outing_harvest_mine($res['log']['site'])) {
                    $this->spring_outing_mine($p, $is_special, $class, $row, $type);
                }
                return 1;
            }
            if ($is_special) {
                $this->spring_outing_shop_special();
            }
            if ($class && $row) {
                $this->spring_outing_shop($type, $class, $row);
            }
            if ($res['log']['times'] == 0) {
                echo '初春青团次数不足</br>';
                return 0;
            }
            foreach ($res['list'] as $v) {
                if ($v['status'] == 0) {
                    $this->spring_outing_action_mine($p, $v['id'], $v['type']);
                    return 1;
                }
            }
            if ($p < 5) {
                $this->spring_outing_mine($p + 1, false, 0, 0, $type);
            }
            return 1;
        } else {
            echo '初春青团打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //初春青团-制作
    private function spring_outing_action_mine($p, $id, $t)
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'action_mine';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['p'] = $p;
        $arr['id'] = $id;
        $arr['t'] = $t;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '初春青团-制作成功</br>';
            return 1;
        } else {
            echo '初春青团-制作失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //初春青团-收货
    private function spring_outing_harvest_mine($s)
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'harvest_mine';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['s'] = $s;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '初春青团-收货成功</br>';
            return 1;
        } else {
            echo '初春青团-收货失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //青团小铺-今日特别
    private function spring_outing_shop_special()
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'shop_special';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开青团小铺-今日特别</br>';
            if ($res['shop']['status'] == 1) {
                $this->spring_outing_shop_buy($res['shop']['type'], $res['shop']['id']);
            }
            return 1;
        } else {
            echo '打开青团小铺-今日特别失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //青团小铺-兑换列表
    private function spring_outing_shop($type = 1, $class, $row)
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'shop';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '青团小铺-兑换列表</br>';
            $r = 0;
            foreach ($res['shop'] as $v) {
                if ($v['kind'] == $class) {
                    $r += 1;
                    if ($r == $row) {
                        for ($i = 0; $i < $v['remain']; $i++) {
                            if (!$this->spring_outing_shop_buy($type, $v['id'])) {
                                break;
                            }
                        }
                        return;
                    }
                }
            }
            return 1;
        } else {
            echo '青团小铺-兑换列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //青团小铺-兑换
    private function spring_outing_shop_buy($type, $id)
    {
        $c['c'] = 'spring_outing';
        $c['m'] = 'shop_buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '兑换成功</br>';
            return 1;
        } else {
            echo '兑换失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //神兵图录
    public function god_weapon_catalog_index($gold = 0, $f1 = 5, $f2 = 5)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开神兵图录</br>';
            if ($res['now_copy']) {
                if ($res['explore_status'] == 2) {
                    $res['now_copy']['event_status'] = 2;
                }
                $this->god_weapon_catalog_next($res['now_copy'], $res['now_copy']['copy_id']);
            }
            $this->god_weapon_catalog_ticket_shop_index(1, $gold);
            for ($i = 0; $i > -1; $i++) {
                if ($this->god_weapon_catalog_explore_start(1, $f1) == 0) {
                    break;
                }
            }
            for ($i = 0; $i > -1; $i++) {
                if ($this->god_weapon_catalog_explore_start(2, $f2) == 0) {
                    break;
                }
            }
            return 1;
        } else {
            echo '打开神兵图录失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-门票商店
    private function god_weapon_catalog_ticket_shop_index($type, $gold)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'ticket_shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        echo '打开神兵图录-门票商店' . $type . '</br>';
        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            foreach ($res['shop_list'] as $v) {
                $num = $v['limit_num'] - $v['buy_num'];
                if ($num > 0 && ($v['cost_type'] == '13' || $v['cost_type'] == '251' || $gold == 1)) {
                    for ($i = 1; $i <= $num; $i++) {
                        if ($this->god_weapon_catalog_buy_ticket($v['id']) == 0) {
                            break;
                        }
                    }
                }
            }
            if ($type == 1) {
                $this->god_weapon_catalog_ticket_shop_index(2, $gold);
            }
            return 1;
        } else {
            echo '打开神兵图录-门票商店' . $type . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-门票商店-购买
    private function god_weapon_catalog_buy_ticket($id)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'buy_ticket';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '购买门票' . $id . '成功</br>';
            return 1;
        } else {
            echo '购买门票' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-探索流程
    private function god_weapon_catalog_next($res, $copy_id)
    {
        if ($res['event_status'] == 2) {
            if ($_POST['god_weapon_catalog_index'][4]) {
                $this->god_weapon_catalog_leave_copy();
            } else {
                $this->god_weapon_catalog_make_god_weaponry();
            }
            return;
        }
        if ($res['event_type'] == 1) {
            $this->god_weapon_catalog_select_route($copy_id, $res['floor'], $res['event_id'], 2);
        } else if ($res['event_type'] == 2) {
            $this->god_weapon_catalog_open_box($copy_id, $res['floor'], $res['event_id']);
        } else if ($res['event_type'] == 3) {
            $this->god_weapon_catalog_battle_start($copy_id, $res['floor'], $res['event_id']);
        }
        return;
    }
    //神兵图录-开始探索
    private function god_weapon_catalog_explore_start($copy_id = 1, $floor = 5)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'explore_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['copy_id'] = $copy_id;
        $arr['floor'] = $floor;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-开始探索' . $copy_id . '</br>';
            $this->god_weapon_catalog_next($res, $copy_id);
            return 1;
        } else {
            echo '神兵图录-开始探索失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-战斗
    private function god_weapon_catalog_battle_start($copy_id, $floor, $event_id)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'battle_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['copy_id'] = $copy_id;
        $arr['floor'] = $floor;
        $arr['event_id'] = $event_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-战斗</br>';
            $this->god_weapon_catalog_next($res, $copy_id);
            return 1;
        } else {
            // var_dump($copy_id,$floor,$event_id);
            echo '神兵图录-战斗失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-开箱
    private function god_weapon_catalog_open_box($copy_id, $floor, $event_id)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'open_box';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['copy_id'] = $copy_id;
        $arr['floor'] = $floor;
        $arr['event_id'] = $event_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-开箱</br>';
            $this->god_weapon_catalog_next($res, $copy_id);
            return 1;
        } else {
            echo '神兵图录-开箱失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-打造神兵
    private function god_weapon_catalog_make_god_weaponry()
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'make_god_weaponry';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-打造神兵,获得:' . $res['get_reward']['reward_info']['name'] . ',品质' . $res['get_reward']['reward_info']['quality'] . '</br>';
            $this->god_weapon_catalog_make_god_weaponry();
            return 1;
        } else {
            echo '神兵图录-打造神兵失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            $this->god_weapon_catalog_leave_copy();
            return 0;
        }
    }
    //神兵图录-离开副本
    private function god_weapon_catalog_leave_copy()
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'leave_copy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-离开副本</br>';
            return 1;
        } else {
            echo '神兵图录-离开副本失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神兵图录-探索-选择bf
    private function god_weapon_catalog_select_route($copy_id, $floor, $event_id, $route_id)
    {
        $c['c'] = 'god_weapon_catalog';
        $c['m'] = 'select_route';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['copy_id'] = $copy_id;
        $arr['floor'] = $floor;
        $arr['event_id'] = $event_id;
        $arr['route_id'] = $route_id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神兵图录-选择buff成功</br>';
            $this->god_weapon_catalog_next($res, $copy_id);
            return 1;
        } else {
            echo '神兵图录-选择buff失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-首页
    private function summer_celebration_sign_index($type = 1)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典打开成功</br>';
            foreach ($res['total_sign_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->summer_celebration_receive_total_sign_reward($v['type'], $v['day']);
                }
            }
            return 1;
        } else {
            echo '夏日庆典打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-签到
    private function summer_celebration_sign($type = 1)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典-签到成功</br>';
            $this->summer_celebration_sign_index($type); //先签到再首页
            return 1;
        } else {
            echo '夏日庆典-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-累计签到奖励
    private function summer_celebration_receive_total_sign_reward($type, $day)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'receive_total_sign_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;
        $arr['day'] = $day;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典-累计签到奖励成功</br>';
            return 1;
        } else {
            echo '夏日庆典-累计签到奖励失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-纪念称号
    private function summer_celebration_appellation_index($type = 1)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'appellation_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典-纪念称号打开成功</br>';
            foreach ($res['task_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->summer_celebration_receive_task_reward($v['title_type'], $v['id']);
                }
            }
            if ($res['now_title']['status'] == 1) {
                $this->summer_celebration_receive_appellation($res['now_title']['title_type']);
            }
            if ($type < 7 && $res['now_day'] >= $res['unlock_day']) {
                $type += 1;
                $this->summer_celebration_appellation_index($type);
            }
            return 1;
        } else {
            echo '夏日庆典-纪念称号打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-纪念称号日常领取
    private function summer_celebration_receive_task_reward($title_type, $task_type)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'receive_task_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['title_type'] = $title_type;
        $arr['task_type'] = $task_type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典-纪念称号日常领取成功</br>';
            return 1;
        } else {
            echo '夏日庆典-纪念称号日常领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //夏日庆典-纪念称号领取
    private function summer_celebration_receive_appellation($title_type)
    {
        $c['c'] = 'summer_celebration';
        $c['m'] = 'receive_appellation';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['title_type'] = $title_type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '夏日庆典-纪念称号领取成功</br>';
            return 1;
        } else {
            echo '夏日庆典-纪念称号领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //藏宝大殿-宝石商店
    private function countryshop_index($tab = 2)
    {
        $c['c'] = 'countryshop';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['tab'] = $tab;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '藏宝大殿-宝石商店打开成功</br>';
            $this->countryshop_buy($res['list'][0]['id']);
            return 1;
        } else {
            echo '藏宝大殿-宝石商店打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //藏宝大殿-宝石商店-购买
    private function countryshop_buy($id = 26, $i = 0)
    {
        if ($i > 300) {
            $this->gem_index();
            $i = 0;
        }
        $c['c'] = 'countryshop';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '藏宝大殿-宝石商店-购买成功</br>';
            $this->countryshop_buy($id, $i + 1);
            return 1;
        } else {
            echo '藏宝大殿-宝石商店-购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //打开宝石
    private function gem_index()
    {
        $c['c'] = 'gem';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开宝石成功,共' . $res['pack']['allpage'] . '页</br>';
            // 如果不足2300页(*12个),直接分解
            if ($res['pack']['allpage'] < 2300) {
                foreach ($res['pack']['list'] as $v) {
                    if ($v['type'] == "1") {
                        $this->gem_look_turn_chip($v['id'], $res['pack']['allpage']);
                        return;
                    }
                }
            } else {
                $arr = [];
                foreach ($res['pack']['list'] as $v) {
                    if ($v['type'] == "1") {
                        if ($v['level'] == "8") {
                            // $id = $v['id'];
                            // for ($i = 0; $i < 1000; $i++) { //升级一千个再一起分解
                            //     if ($this->gem_level_up($id + $i)) {
                            //         $arr[] = $id + $i;
                            //     } else {
                            //         break;
                            //     }
                            // }
                            // break;
                            $arr[] = $v['id'];
                        } else { //不是8级的先批量分解了
                            $this->gem_look_turn_chip($v['id'], $res['pack']['allpage']);
                            return;
                        }
                    }
                }
                if (count($arr) > 0) {
                    $this->gem_gem_turn_chip($arr, $res['pack']['allpage']);
                }
            }

            return 1;
        } else {
            echo '打开宝石失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //分解宝石预览
    private function gem_look_turn_chip($id, $all_pages)
    {
        $c['c'] = 'gem';
        $c['m'] = 'look_turn_chip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '获取宝石数据</br>';
            $ids = [];
            foreach ($res['list'] as $v) {
                $ids[] = $v['id'];
            }
            if (count($ids) > 0) {
                $this->gem_gem_turn_chip($ids, $all_pages);
            }
            return 1;
        } else {
            echo '获取宝石数据失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //分解宝石
    private function gem_gem_turn_chip($ids, $all_pages)
    {
        $c['c'] = 'gem';
        $c['m'] = 'gem_turn_chip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['entype'] = 1;
        $arr['id'] = implode(",", $ids);

        $res = $this->post($url, $arr, [], 0);
        if (count($ids) > 10000) {
            echo '批量分解宝石超过1w个,接口会超时,需要等大约一分钟才能有结果</br>';
        }
        if ($res['status'] == 1) {
            echo '分解宝石成功,剩余' . $all_pages . '页</br>';
            $arr = [];
            foreach ($res['list'] as $v) {
                if ($v['type'] == "1") {
                    // 如果不足2300页(*12个),直接分解
                    if ($all_pages < 2300) {
                        $this->gem_look_turn_chip($v['id'], $all_pages);
                        return;
                    }
                    if ($v['level'] == "8") {
                        $arr[] = $v['id'];
                    } else { //不是8级的先批量分解了
                        $this->gem_look_turn_chip($v['id'], $all_pages);
                        return;
                    }
                }
            }
            if (count($arr) > 0) {
                $this->gem_gem_turn_chip($arr, $all_pages - ceil(count($arr) / 12));
            }
            // $this->gem_index();
            return 1;
        } else {
            echo '分解宝石失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //升级宝石
    private function gem_level_up($id)
    {
        $c['c'] = 'gem';
        $c['m'] = 'level_up';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '升级宝石 ';
            return 1;
        } else {
            echo '升级宝石失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神武-神铸
    private function god_martial_art_divine_casting($type = 2)
    {
        $c['c'] = 'god_martial_art';
        $c['m'] = 'divine_casting';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '神武-神铸成功</br>';
            return 1;
        } else {
            echo '神武-神铸失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //神武-神铸领取
    private function god_martial_art_receive_divine_casting_reward()
    {
        $c['c'] = 'god_martial_art';
        $c['m'] = 'receive_divine_casting_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '神武-神铸领取成功</br>';
            return 1;
        } else {
            echo '神武-神铸领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    //避暑圣地
    private function summer_resort_index($again = false, $is_reverse = true)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开避暑圣地成功</br>';
            if (!$again) {
                $this->summer_resort_sign_index();
                $this->summer_resort_build_mall();
                $this->summer_resort_index(true, $is_reverse);
            }
            if ($is_reverse) {
                $list = array_reverse($res['build_info']);
            } else {
                $list = $res['build_info'];
            }
            $stone = $res['user_info']['stone'];
            $tree = $res['user_info']['tree'];
            foreach ($list as $v) {
                $num = $v['build_num'] - $v['own_building_level'];
                $stone_num = (int) ($stone / $v['cost_stone']);
                $tree_num = (int) ($tree / $v['cost_tree']);
                $byu_num = min($num, $stone_num, $tree_num);
                if ($byu_num > 0 && $this->summer_resort_build($v['id'], $byu_num)) {
                    $stone -= $byu_num * $v['cost_stone'];
                    $tree -= $byu_num * $v['cost_tree'];
                }
            }
            $this->summer_resort_build_success();
            return 1;
        } else {
            echo '打开避暑圣地失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-建造
    private function summer_resort_build($buildid, $num)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'build';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['buildid'] = $buildid;
        $arr['num'] = $num;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '避暑圣地-建造成功,获得' . $res['reward']['num'] . '元宝</br>';
            return 1;
        } else {
            echo '避暑圣地-建造失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-成就
    private function summer_resort_build_success()
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'build_success';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '避暑圣地-成就打开</br>';
            foreach ($res['reward'] as $v) {
                if ($v['is_take'] == 1) {
                    $this->summer_resort_take_success($v['id']);
                }
            }
            return 1;
        } else {
            echo '避暑圣地-成就失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-领取成就
    private function summer_resort_take_success($id)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'take_success';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo $res['reward']['details'] . '领取成就成功</br>';
            return 1;
        } else {
            echo '领取成就失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-每日签到
    private function summer_resort_sign_index()
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'sign_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开避暑圣地-每日签到</br>';
            foreach ($res['reward_list'] as $v) {
                if ($v['take_status'] == 1) {
                    $this->summer_resort_sign($v['id']);
                }
            }
            return 1;
        } else {
            echo '打开避暑圣地-每日签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-每日签到动作
    private function summer_resort_sign($day)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'sign';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['day'] = $day;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '签到成功</br>';
            return 1;
        } else {
            echo '签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-兑换商店
    private function summer_resort_build_mall($mall = 1)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'build_mall';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mall'] = $mall;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开避暑圣地-兑换商店</br>';
            foreach ($res['rewards'] as $v1) {
                $my_goods = $v1[0]['my_goods'];
                foreach ($v1 as $v2) {
                    $num = $v2['limit_num'] - $v2['own_buy_num'];
                    if ($num > 0) {
                        for ($i = 0; $i < $num; $i++) {
                            if ($my_goods < $v2['cost_num']) {
                                continue 2;
                            }
                            if ($this->summer_resort_buy_build_mall($mall, $v2['id'])) {
                                $my_goods -= $v2['cost_num'];
                            }
                        }
                    }
                }
            }
            return 1;
        } else {
            echo '打开避暑圣地-兑换商店失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //避暑圣地-兑换商店购买
    private function summer_resort_buy_build_mall($mall, $id)
    {
        $c['c'] = 'summer_resort';
        $c['m'] = 'buy_build_mall';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['mall'] = $mall;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '购买成功</br>';
            return 1;
        } else {
            echo '购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春
    private function jaderabbit_receivespring_login_index()
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'login_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开玉兔迎春</br>';
            foreach ($res['reward_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->jaderabbit_receivespring_receive_login_reward($v['day']);
                }
            }
            $this->jaderabbit_receivespring_blessing_index();
            $this->jaderabbit_receivespring_year_monster_index();
            return 1;
        } else {
            echo '打开玉兔迎春失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-新春祝福
    private function jaderabbit_receivespring_blessing_index()
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'blessing_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开玉兔迎春-新春祝福</br>';
            if ($res['reward_list'][0]['status'] == 0 || $res['reward_list'][0]['status'] == 1) {
                $this->chat_send_once($res['common_blessing_word'][0]);
                $this->jaderabbit_receivespring_receive_blessing_reward();
            }
            return 1;
        } else {
            echo '打开玉兔迎春-新春祝福失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-新春祝福-领取
    private function jaderabbit_receivespring_receive_blessing_reward($type = 1)
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'receive_blessing_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '玉兔迎春-新春祝福-领取成功</br>';
            return 1;
        } else {
            echo '玉兔迎春-新春祝福-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-打年兽
    private function jaderabbit_receivespring_year_monster_index($again = false)
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'year_monster_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开玉兔迎春-打年兽</br>';
            if ($res['remain_attack_times'] > 0 && !$again) {
                for ($i = 0; $i < $res['remain_attack_times']; $i++) {
                    $this->jaderabbit_receivespring_hit_year_monster();
                }
                $this->jaderabbit_receivespring_year_monster_index(true);
                return 1;
            }
            if ($res['percentage_blood_reward']['status1'] == 1) {
                $this->jaderabbit_receivespring_receive_year_monster_harm(1);
            }
            if ($res['percentage_blood_reward']['status2'] == 1) {
                $this->jaderabbit_receivespring_receive_year_monster_harm(2);
            }
            if ($res['percentage_blood_reward']['status3'] == 1) {
                $this->jaderabbit_receivespring_receive_year_monster_harm(3);
            }
            if ($res['final_award']['status'] == 1) {
                $this->jaderabbit_receivespring_receive_year_monster_harm(4);
            }
            return 1;
        } else {
            echo '打开玉兔迎春-打年兽失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-打年兽-领奖
    private function jaderabbit_receivespring_receive_year_monster_harm($type)
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'receive_year_monster_harm';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 1000000);
        if ($res['status'] == 1) {
            echo '玉兔迎春-打年兽-领奖</br>';
            return 1;
        } else {
            echo '玉兔迎春-打年兽-领奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-打年兽-放鞭炮
    private function jaderabbit_receivespring_hit_year_monster($type = 1)
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'hit_year_monster';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 3000000);
        if ($res['status'] == 1) {
            echo '玉兔迎春-打年兽-放鞭炮</br>';
            return 1;
        } else {
            echo '玉兔迎春-打年兽-放鞭炮失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //玉兔迎春-签到
    private function jaderabbit_receivespring_receive_login_reward($day)
    {
        $c['c'] = 'jaderabbit_receivespring';
        $c['m'] = 'receive_login_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['day'] = $day;

        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            echo '玉兔迎春-签到成功' . $day . '</br>';
            return 1;
        } else {
            echo '玉兔迎春-签到失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 十一周年庆-周年商城
    private function act11th_anniversary_shop_index($shop_type)
    {
        $c['c'] = 'act11th_anniversary';
        $c['m'] = 'shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十一周年庆-周年商城打开成功,剩余开盲盒次数' . $res['shop_reward_num'] . '</br>';
            // 1:黄券 2:红券 3:紫 4:声望 5:战功 6:道符 7星魂 8宝石碎片 9元宝 10额度
            $res['shop_detail'] = array_values($res['shop_detail']);
            if ($res['shop_detail'][0]['shop_type'] == $shop_type) {
                $this->act11th_anniversary_shop_lottery($shop_type);
            } else {
                $this->act11th_anniversary_shop_refresh($shop_type);
            }
            return 1;
        } else {
            echo '十一周年庆-周年商城打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 十一周年庆-福利抽奖
    private function act11th_anniversary_lottery()
    {
        $c['c'] = 'act11th_anniversary';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十一周年庆-福利抽奖成功</br>';
            $this->act11th_anniversary_lottery();
            return 1;
        } else {
            echo '十一周年庆-福利抽奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //十一周年庆-周年商城刷新
    private function act11th_anniversary_shop_refresh($shop_type)
    {
        $c['c'] = 'act11th_anniversary';
        $c['m'] = 'shop_refresh';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十一周年庆-周年商城刷新成功</br>';
            $this->act11th_anniversary_shop_index($shop_type);
            return 1;
        } else {
            echo '十一周年庆-周年商城刷新失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //十一周年庆-周年商城开盲盒
    private function act11th_anniversary_shop_lottery($shop_type)
    {
        $c['c'] = 'act11th_anniversary';
        $c['m'] = 'shop_lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '十一周年庆-周年商城开盲盒成功</br>';
            $this->act11th_anniversary_shop_index($shop_type);
            return 1;
        } else {
            echo '十一周年庆-周年商城开盲盒失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    private function fishing($is_qiangdu = 1)
    {
        $fishing = $this->fishing_index();
        if ($fishing) {
            echo '打开愿者上钩,当前选择' . ($is_qiangdu == 1 ? '优先强度强击' : '只替换同属性') . '</br>';
            // 倒序渔场等级,进入解锁的最高渔场
            // $ground = array_reverse($fishing['ground']);
            // foreach ($ground as $v) {
            //     if($v['unlock'] == 1){
            //         if($fishing['base']['pre_ground'] != $v['id']){
            //             $this->fishing_setting($v['id'],1);
            //             $this->fishing();
            //             return;
            //         }
            //         break;
            //     }
            // }
            // 倒序渔场饲料
            usort($fishing['bait'], function ($a, $b) {
                return $a['quality'] - $b['quality'];
            });
            $bait = array_reverse($fishing['bait']);
            $id = $bait[0]['id'];
            foreach ($bait as $v) {
                if ($v['id'] == $fishing['base']['pre_bait']) {
                    echo '鱼饵:' . $v['name'] . '</br>';
                    $id = $v['id'];
                }
            }
            // 钓鱼
            $this->fishing_start_fishing($id, $fishing['base']['pre_ground'], $is_qiangdu);
        }
    }
    //愿者上钩
    private function fishing_index()
    {
        $c['c'] = 'fishing';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            return $res;
        } else {
            echo '打开愿者上钩失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //愿者上钩-切换渔场
    private function fishing_setting($args, $type = 1)
    {
        $c['c'] = 'fishing';
        $c['m'] = 'setting';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['args'] = $args;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo $args . '切换渔场成功</br>';
            return 1;
        } else {
            echo '切换渔场失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //愿者上钩-钓鱼
    private function fishing_start_fishing($bait, $ground, $is_qiangdu)
    {
        $c['c'] = 'fishing';
        $c['m'] = 'start_fishing';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['bait'] = $bait;
        $arr['ground'] = $ground;

        $res = $this->post($url, $arr, [], 2000000);
        if ($res['status'] == 1) {
            $fish_type = [
                '1' => '小型鱼',
                '2' => '中型鱼',
                '3' => '大型鱼',
                '4' => '水中生物',
            ];
            echo '钓鱼成功,' . $fish_type[$res['fish']['type']] . ':' . $res['fish']['name'] . '</br>';
            if ($res['fish_status'] == 1) {
                // 获取渔场信息
                $fishing = $this->fishing_index();
                // 获取各个类型的鱼数
                $num = [
                    'type1' => 0,
                    'type2' => 0,
                    'type3' => 0,
                    'type4' => 0,
                ];
                $all_num = [
                    'type1' => $fishing['aquarium']['small_num'],
                    'type2' => $fishing['aquarium']['medium_num'],
                    'type3' => $fishing['aquarium']['big_num'],
                    'type4' => $fishing['aquarium']['other_num'],
                ];
                foreach ($fishing['fish'] as $v) {
                    if ($v['in_box'] == 1) {
                        $num['type' . $v['type']] += 1;
                    }
                }
                //水族箱没满直接放进去
                if ($all_num['type' . $res['fish']['type']] > $num['type' . $res['fish']['type']]) {
                    echo '水族箱没满直接放进去</br>';
                    $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                    $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                    return;
                }
                // 满了的情况
                //循环两次,第一次判断是否同属性,第二次判断属性大小;防止钓两条锦鲤替换同一个位置的情况
                if ($is_qiangdu == 1) {
                    foreach ($fishing['fish'] as $v) {
                        // 体积类型相同才处理
                        if ($v['type'] == $res['fish']['type']) {
                            //攻击强度优先
                            if ($res['fish']['att_type1'] == 125 || $res['fish']['att_type1'] == 126) {
                                if ($v['att_type1'] == $res['fish']['att_type1']) {
                                    continue;
                                }
                                echo '钓到攻击强度</br>';
                                $res = $this->fishing_sell($v['id']);
                                $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                                $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                                return 1;
                            }
                            // 强击仅次于攻击强度
                            if (($res['fish']['att_type1'] == 113 || $res['fish']['att_type1'] == 114) && ($v['att_type1'] != 125 && $v['att_type1'] != 126)) {
                                if ($v['att_type1'] == $res['fish']['att_type1']) {
                                    continue;
                                }
                                echo '钓到强击</br>';
                                $res = $this->fishing_sell($v['id']);
                                $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                                $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                                return 1;
                            }
                        }
                    }
                }
                foreach ($fishing['fish'] as $v) {
                    // 体积类型相同才处理
                    if ($v['type'] == $res['fish']['type']) {
                        if ($is_qiangdu == 1) {
                            //攻击强度优先
                            if ($res['fish']['att_type1'] == 125 || $res['fish']['att_type1'] == 126) {
                                if ($v['att_type1'] == $res['fish']['att_type1'] && $v['att_value1'] >= $res['fish']['att_value1']) {
                                    continue;
                                }
                                echo '钓到攻击强度</br>';
                                $res = $this->fishing_sell($v['id']);
                                $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                                $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                                return 1;
                            }
                            // 强击仅次于攻击强度
                            if (($res['fish']['att_type1'] == 113 || $res['fish']['att_type1'] == 114) && ($v['att_type1'] != 125 && $v['att_type1'] != 126)) {
                                if ($v['att_type1'] == $res['fish']['att_type1'] && $v['att_value1'] >= $res['fish']['att_value1']) {
                                    continue;
                                }
                                echo '钓到强击</br>';
                                $res = $this->fishing_sell($v['id']);
                                $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                                $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                                return 1;
                            }
                        }
                        // 类型相等&属性类型相等&老属性<新属性 则卖出并替换
                        if ($v['att_type1'] == $res['fish']['att_type1'] && $v['att_type2'] == $res['fish']['att_type2'] && $v['att_value1'] < $res['fish']['att_value1'] && $v['att_value2'] < $res['fish']['att_value2']) {
                            $res = $this->fishing_sell($v['id']);
                            $this->fishing_deal_fish(array_reverse($res['new_fish_deal']['deal'])[0]);
                            $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
                            return 1;
                        }
                    }
                }
                // 无用鱼直接售出
                $this->fishing_deal_fish($res['new_fish_deal']['deal'][0], $res['new_fish_deal']['fish_autoid']);
                return;
            }
            if ($res['fish_status'] == 3) {
                echo '脱钩了</br>';
            }
            $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
            return 1;
        } else {
            echo '钓鱼失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            if ($res['status'] == 103) {
                $fishing = $this->fishing_index();
                $this->fishing_deal_fish($fishing['new_fish_deal']['deal'][0], $fishing['new_fish_deal']['fish_autoid']);
                $this->fishing_start_fishing($bait, $ground, $is_qiangdu);
            }
            return 0;
        }
    }
    //愿者上钩-卖鱼(水箱里的)
    private function fishing_sell($fishid)
    {
        $c['c'] = 'fishing';
        $c['m'] = 'sell';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['fishid'] = $fishid;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '愿者上钩-卖鱼成功</br>';
            return $res;
        } else {
            echo '愿者上钩-卖鱼失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //愿者上钩-放入水族箱(有fishid代表直接卖掉换币)
    private function fishing_deal_fish($deal, $fishid = '', $await = 1000000)
    {
        $c['c'] = 'fishing';
        $c['m'] = 'deal_fish';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['deal'] = $deal;
        if ($fishid) {
            $arr['fishid'] = $fishid;
        }

        // echo '等待12s...</br>';
        $res = $this->post($url, $arr, [], $await);
        if ($res['status'] == 1) {
            if ($fishid) {
                echo '出售成功</br>';
            } else {
                echo '放入水族箱成功</br>';
            }
            $this->fishing($_POST['fishing'][1]);
            return 1;
        } else {
            if ($res['status'] == 112) {
                echo $res['msg'] . '</br>';
                $this->fishing_deal_fish($deal, $fishid, $await);
                return 1;
            }
            if ($fishid) {
                echo '出售失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            } else {
                echo '放入水族箱失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            }
            return 0;
        }
    }
    // 登录返礼
    private function loginreward_index()
    {
        $c['c'] = 'loginreward';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '打开登录返礼成功</br>';
            foreach ($res['reward'] as $v) {
                if ($v['is_re'] == 1) {
                    $this->loginreward_action_reward(2, $v['id']);
                }
            }
            if ($res['reward_index']['is_re'] == 1) {
                $this->loginreward_action_reward(1, $res['reward_index']['id']);
            }
            return $res;
        } else {
            echo '打开登录返礼失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 登录返礼-领取
    private function loginreward_action_reward($type, $reward_id)
    {
        $c['c'] = 'loginreward';
        $c['m'] = 'action_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['reward_id'] = $reward_id;
        $arr['type'] = $type;

        $res = $this->post($url, $arr);
        if ($res['status'] == 1) {
            echo '登录返礼-领取' . $reward_id . '成功</br>';
            return $res;
        } else {
            echo '登录返礼-领取' . $reward_id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-副本挑战奖励
    private function act_spring_get_rank($type = 1)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'get_rank';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开萌宠探福-副本挑战成功</br>';
            foreach ($res['achievement'] as $v) {
                if ($v['status'] == 1) {
                    $this->act_spring_receive($v['id']);
                }
            }
            $this->act_spring_get_rank($type + 1);
            return 1;
        } else {
            echo '打开萌宠探福-副本挑战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-副本挑战奖励领取
    private function act_spring_receive($id)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'receive';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '萌宠探福-副本挑战奖励领取' . $id . '成功</br>';
            return 1;
        } else {
            echo '萌宠探福-副本挑战奖励领取' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-竞猜
    private function act_spring_gamble_index($stake = 15000)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'gamble_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开萌宠探福-竞猜成功,当前竞猜人数:' . $res['bet_users'] . ',开奖元宝:' . $res['bet_golds'] . '</br>';
            if (!$res['mine_stake']) {
                $this->act_spring_bet($stake);
            }
            return 1;
        } else {
            echo '打开萌宠探福-竞猜失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-竞猜
    private function act_spring_bet($stake = 15000)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'bet';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['stake'] = $stake;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '萌宠探福-竞猜' . $stake . '成功</br>';
            return 1;
        } else {
            echo '萌宠探福-竞猜' . $stake . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-福币商店
    private function act_spring_shop_index($id)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'shop_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开萌宠探福-福币商店成功,当前福币:' . $res['fuka'] . '</br>';
            if (is_numeric($id)) {
                $this->act_spring_exchange($id);
            } else {
                foreach ($res['shop']['1'] as $v) {
                    if ($v['name'] == $id) {
                        $this->act_spring_exchange($v['id']);
                    }
                }
            }
            return $res;
        } else {
            echo '打开萌宠探福-福币商店失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 萌宠探福-福币商店-购买
    private function act_spring_exchange($id)
    {
        $c['c'] = 'act_spring';
        $c['m'] = 'exchange';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '萌宠探福-福币商店-购买' . $id . '成功</br>';
            $this->act_spring_exchange($id);
            return 1;
        } else {
            echo '萌宠探福-福币商店-购买' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 道符商店
    private function sorcery_sorcery_exchange_list($ids)
    {
        $c['c'] = 'sorcery';
        $c['m'] = 'sorcery_exchange_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开道符商店成功</br>';
            foreach ($res['goods_list'] as $v) {
                if (in_array($v['id'], $ids)) {
                    for ($i = 0; $i < 20; $i++) {
                        if (!$this->sorcery_exchange_start($v['id'])) {
                            break;
                        }
                    }
                }
            }
            return 1;
        } else {
            echo '打开道符商店失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 道符商店-购买
    private function sorcery_exchange_start($id)
    {
        $c['c'] = 'sorcery';
        $c['m'] = 'exchange_start';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '道符商店-购买' . $id . '成功</br>';
            return 1;
        } else {
            echo '道符商店-购买' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓商店
    private function drum_shop_index()
    {
        $c['c'] = 'drum_shop';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $num = floor($res['info']['materials_50'] / $res['info']['info']['now_price']);
            echo '打开战鼓商店成功,当低级材料:' . $res['info']['materials_50'] . ',单价:' . $res['info']['info']['now_price'] . ',可购买' . $num . '个</br>';
            $this->drum_shop_buy(1, $num);
            return 1;
        } else {
            echo '打开战鼓商店失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓商店-购买
    private function drum_shop_buy($id = 1, $num = 1)
    {
        $c['c'] = 'drum_shop';
        $c['m'] = 'buy';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;
        $arr['num'] = $num;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '战鼓商店-购买成功,剩余战鼓蓝:' . $res['materials_50'] . ',黄:' . $res['materials_51'] . ',红:' . $res['materials_52'] . ',紫:' . $res['materials_53'] . '</br>';
            return 1;
        } else {
            echo '战鼓商店-购买失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓分解列表
    private function equip_forge_get_drum_list($limit)
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'get_drum_list';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['drum_id'] = 1;
        $c['limit'] = min(10000, $limit);
        $url = $this->transformation_url($c, $this->token);

        $res = $this->post($url, [], [], 0);
        if ($res['status'] == 1) {
            echo '战鼓分解列表获取成功</br>';
            $ids = implode(',', array_column($res['data'], 'id'));
            $this->drum_forge_resolve_mulit($ids);
            if (count($res['data']) >= 10000) {
                $this->equip_forge_get_drum_list(min(10000, $limit - 10000));
            }
            return 1;
        } else {
            echo '战鼓分解列表获取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓分解-查看数量
    private function equip_forge_get_drum_count()
    {
        $c['c'] = 'equip_forge';
        $c['m'] = 'get_drum_count';
        $c['d'] = 'newequip';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $c['drum_id'] = 1;
        $url = $this->transformation_url($c, $this->token);

        $res = $this->post($url, [], [], 0);
        if ($res['status'] == 1) {
            echo '当前战鼓数量:' . $res['data'] . '</br>';
            if ($res['data'] > 0) {
                $this->equip_forge_get_drum_list($res['data']);
            }
            return 1;
        } else {
            echo '战鼓数量获取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 战鼓分解
    private function drum_forge_resolve_mulit($ids)
    {
        $c['c'] = 'drum_forge';
        $c['m'] = 'resolve_mulit';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $ids;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '战鼓分解成功</br>';
            return 1;
        } else {
            echo '战鼓分解失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 领红包
    private function act_national_day_index()
    {
        $c['c'] = 'act_national_day';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开领红包成功</br>';
            foreach ($res['list'] as $k => $v) {
                if ($v['status'] == 0 && $v['gold'] > 0) {
                    $this->act_national_day_open_red_packets($v['ymd']);
                }
            }
            return 1;
        } else {
            echo '打开领红包失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 领红包-动作
    private function act_national_day_open_red_packets($ymd)
    {
        $c['c'] = 'act_national_day';
        $c['m'] = 'open_red_packets';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['ymd'] = $ymd;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo $ymd . '领红包成功</br>';
            return 1;
        } else {
            echo $ymd . '领红包失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 整军
    private function exercise_open_gift()
    {
        $c['c'] = 'exercise';
        $c['m'] = 'open_gift';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '整军成功</br>';
            $this->exercise_open_gift();
            return 1;
        } else {
            echo '整军失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 决战(逐鹿)
    private function compete_index()
    {
        $c['c'] = 'compete';
        $c['m'] = 'index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '打开决战(逐鹿)</br>';
            if ($res['is_get'] == 1) {
                $this->compete_get_reward();
            } else {
                foreach ($res['list'] as $k => $v) {
                    if ($this->compete_action($v['uid'])) {
                        return 1;
                    }
                }
            }
            return 1;
        } else {
            echo '打开决战(逐鹿)失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 决战(逐鹿)-领取
    private function compete_get_reward()
    {
        $c['c'] = 'compete';
        $c['m'] = 'get_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '决战(逐鹿)-领取成功</br>';
            return 1;
        } else {
            echo '决战(逐鹿)-领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 决战(逐鹿)-攻击
    private function compete_action($t)
    {
        $c['c'] = 'compete';
        $c['m'] = 'action';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['t'] = $t;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '决战(逐鹿)-攻击' . ($res['info']['win'] > 0 ? '胜利' : '失败') . ',当前排名:' . $res['info']['rank'] . '</br>';
            if ($res['info']['win'] > 0) {
                foreach ($res['info']['list'] as $k => $v) {
                    if ($this->compete_action($v['uid'])) {
                        return 1;
                    }
                }
            } else {
                return 0;
            }
            return 1;
        } else {
            echo '决战(逐鹿)-攻击失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 节日礼包
    private function act_holiday_add_login_reward()
    {
        $c['c'] = 'act_holiday';
        $c['m'] = 'add_login_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '节日礼包每日领取</br>';
            return 1;
        } else {
            echo '节日礼包每日领取失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 圣诞礼物-打开获取次数
    private function christ_present_get_times_index()
    {
        $c['c'] = 'christ_present';
        $c['m'] = 'get_times_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '圣诞礼物-获取次数打开</br>';
            foreach ($res['task_list'] as $v) {
                if ($v['status'] == 1) {
                    $this->christ_present_receive_times($v['type']);
                }
            }
            $this->christ_present_open_gift();
            return 1;
        } else {
            echo '圣诞礼物-获取次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 圣诞礼物-领取次数
    private function christ_present_receive_times($type)
    {
        $c['c'] = 'christ_present';
        $c['m'] = 'receive_times';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['type'] = $type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '圣诞礼物-领取次数成功</br>';
            return 1;
        } else {
            echo '圣诞礼物-领取次数失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 圣诞礼物-拆礼物
    private function christ_present_open_gift()
    {
        $c['c'] = 'christ_present';
        $c['m'] = 'open_gift';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 2500000);
        if ($res['status'] == 1) {
            echo '圣诞礼物-拆礼物成功</br>';
            $this->christ_present_open_gift();
            return 1;
        } else {
            echo '圣诞礼物-拆礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-打开挂礼物
    private function treasure_send_gift_index()
    {
        $c['c'] = 'treasure';
        $c['m'] = 'send_gift_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开挂礼物成功</br>';
            if ($res['white'] > 0) {
                $this->treasure_choice_snow(1);
            }
            if ($res['gold'] > 0) {
                $this->treasure_choice_snow(2);
            }
            if ($res['colour'] > 0) {
                $this->treasure_choice_snow(3);
            }
            return 1;
        } else {
            echo '双旦夺宝-打开挂礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-打开摘礼物
    private function treasure_pick_index()
    {
        $c['c'] = 'treasure';
        $c['m'] = 'pick_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开摘礼物成功</br>';
            if ($res['white_pick'] > 0) {
                $this->treasure_pick_list(1);
            }
            if ($res['gold_pick'] > 0) {
                $this->treasure_pick_list(2);
            }
            if ($res['colour_pick'] > 0) {
                $this->treasure_pick_list(3);
            }
            return 1;
        } else {
            echo '双旦夺宝-打开摘礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-打开摘礼物列表
    private function treasure_pick_list($snow_type, $page = 1)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'pick_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['snow_type'] = $snow_type;
        $arr['page'] = $page;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开摘礼物列表成功</br>';
            $this->treasure_pick($res['list'][0]['id']);
            return 1;
        } else {
            echo '双旦夺宝-打开摘礼物列表失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-摘礼物
    private function treasure_pick($id)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'pick';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-摘礼物' . $id . '成功</br>';
            return 1;
        } else {
            echo '双旦夺宝-摘礼物' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-打开抢礼物
    private function treasure_rob_list($snow_type = 1, $page = 1)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'rob_list';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['snow_type'] = $snow_type;
        $arr['page'] = $page;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开抢礼物成功</br>';
            foreach ($res['list'] as $v) {
                $this->treasure_rob($v['id']);
            }
            if ($res['pages'] > $page) {
                $this->treasure_rob_list($snow_type, $page + 1);
            }
            if ($snow_type < 3) {
                $this->treasure_rob_list($snow_type + 1, 1);
            }
            return 1;
        } else {
            echo '双旦夺宝-打开抢礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-打开夺宝战
    private function treasure_boss_index()
    {
        $c['c'] = 'treasure';
        $c['m'] = 'boss_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开夺宝战成功</br>';
            if ($res['robnum'] > 0) {
                for ($i = 0; $i < $res['robnum']; $i++) {
                    if (!$this->treasure_boss_fight()) {
                        break;
                    }
                }
            }
            foreach ($res['reward'] as $v) {
                $this->treasure_get_boss_reward($v['id']);
            }
            return 1;
        } else {
            echo '双旦夺宝-打开夺宝战失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-夺宝战-攻击驯鹿
    private function treasure_boss_fight()
    {
        $c['c'] = 'treasure';
        $c['m'] = 'boss_fight';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-夺宝战-攻击驯鹿成功</br>';
            return 1;
        } else {
            echo '双旦夺宝-夺宝战-攻击驯鹿失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-夺宝战-领奖
    private function treasure_get_boss_reward($id)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'get_boss_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-夺宝战-领奖' . $id . '成功</br>';
            return 1;
        } else {
            echo '双旦夺宝-夺宝战-领奖' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-抢礼物
    private function treasure_rob($id)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'rob';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            if ($res['info']['win'] > 0) {
                echo '双旦夺宝-抢礼物战斗失败' . $id . '</br>';
            } else {
                echo '双旦夺宝-抢礼物战斗成功' . $id . '</br>';
            }
            return 1;
        } else {
            echo '双旦夺宝-抢礼物' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 双旦夺宝-选择挂礼物
    private function treasure_choice_snow($snow_type, $check_num = 0)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'choice_snow';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['snow_type'] = $snow_type;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-打开选择挂礼物成功</br>';
            $sid = $res['new_list'][1][0]['id'];
            $tid = $res['new_list'][2][$check_num]['id'];
            $this->treasure_send_gift($snow_type, $sid, $tid);
            return 1;
        } else {
            echo '双旦夺宝-打开选择挂礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }

    // 双旦夺宝-送出礼物
    private function treasure_send_gift($snow_type, $sid, $tid)
    {
        $c['c'] = 'treasure';
        $c['m'] = 'send_gift';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['snow_type'] = $snow_type;
        $arr['sid'] = $sid;
        $arr['tid'] = $tid;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '双旦夺宝-送出礼物成功</br>';
            return 1;
        } else {
            echo '双旦夺宝-送出礼物失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 新宝物抽奖
    private function new_treasure_lottery($num = 5)
    {
        $c['c'] = 'new_treasure';
        $c['m'] = 'lottery';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['num'] = $num; //这个数字是给你的宝物数量,游戏后端没限制(已和谐)

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            $str = '新宝物抽奖成功,获得宝物:';
            foreach ($res['reward'] as $v) {
                $str .= $v['info']['name'] . '*' . $v['num'];
            }
            $str .= '</br>';
            echo $str;
            switch ($res['reward'][0]['reward_id']) {
                case 22:
                    $num = 2;
                    break;
                case 23:
                    $num = 3;
                    break;
                case 24:
                    $num = 5;
                    break;
            }
            $this->new_treasure_lottery($num);
            return 1;
        } else {
            echo '新宝物抽奖失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    // 12周年庆
    private function act12th_anniversary_activity1_index()
    {
        $c['c'] = 'act12th_anniversary';
        $c['m'] = 'activity1_index';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '12周年庆打开成功</br>';
            foreach ($res['user_task'] as $v) {
                if ($v['now_num'] >= $v['task_num']) {
                    $this->act12th_anniversary_activity1_task_reward($v['id']);
                }
            }
            return 1;
        } else {
            echo '12周年庆打开失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
    //12周年领取
    private function act12th_anniversary_activity1_task_reward($id)
    {
        $c['c'] = 'act12th_anniversary';
        $c['m'] = 'activity1_task_reward';
        $c['token_uid'] = $this->token_uid;
        $c['token'] = $this->token;
        $url = $this->transformation_url($c, $this->token);
        $arr['token'] = $this->token;
        $arr['id'] = $id;

        $res = $this->post($url, $arr, [], 0);
        if ($res['status'] == 1) {
            echo '12周年领取' . $id . '成功</br>';
            return 1;
        } else {
            echo '12周年领取' . $id . '失败:' . $res['msg'] . ',状态码:' . $res['status'] . '</br>';
            return 0;
        }
    }
}
if ($_POST['register'] == 1) {
    $test = new demo();
    $res = $test->register0($_FILES['upload']['tmp_name']);
    die;
}
$test = new demo();
$test->mac = $mac->mac_addr;
$res = $test->run($_FILES['upload']['tmp_name'], $_POST);
